//
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        private void Test(WWTimeDependentForwardFourierTransform t, WWTimeDependentInverseFourierTransform f, double [] x, int fragmentSize)
        {
            int iPos = 0;
            int oPos = 0;

            // Processのテスト。
            while (iPos < x.Length)
            {
                int size = fragmentSize;
                if (x.Length - iPos < size)
                {
                    size = x.Length - iPos;
                }

                var xF = new double[size];
                Array.Copy(x, iPos, xF, 0, size);
                iPos += size;

                var X = t.Process(xF);
                if (0 < X.Length)
                {
                    var xR = f.Process(X);
                    if (0 <= xR.Length)
                    {
                        for (int j = 0; j < xR.Length; ++j)
                        {
                            Assert.IsTrue(Math.Abs(xR[j] - x[oPos]) < 1e-8);
                            ++oPos;
                        }
                    }
                }
            }

            {
                // Drainのテスト。
                var X  = t.Drain();
                var xR = f.Process(X);
                for (int j = 0; j < xR.Length; ++j)
                {
                    if (x.Length <= oPos)
                    {
                        break;
                    }
                    Assert.IsTrue(Math.Abs(xR[j] - x[oPos]) < 1e-8);
                    ++oPos;
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Forward FFTに滞留している入力データをすべて出力。
 /// </summary>
 public WWComplex[] Drain()
 {
     return(mFFTfwd.Drain());
 }