当前位置: 首页>>代码示例>>C#>>正文


C# Complex.CopyTo方法代码示例

本文整理汇总了C#中Complex.CopyTo方法的典型用法代码示例。如果您正苦于以下问题:C# Complex.CopyTo方法的具体用法?C# Complex.CopyTo怎么用?C# Complex.CopyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Complex的用法示例。


在下文中一共展示了Complex.CopyTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VerifyMatchesNaiveComplex

        /// <summary>
        /// Verify matches naive complex.
        /// </summary>
        /// <param name="samples">Samples count.</param>
        /// <param name="maximumError">Maximum error.</param>
        /// <param name="naive">Naive transform.</param>
        /// <param name="fast">Fast delegate.</param>
        private static void VerifyMatchesNaiveComplex(
            Complex[] samples,
            double maximumError,
            Func<Complex[], Complex[]> naive,
            Action<Complex[]> fast)
        {
            var spectrumNaive = naive(samples);

            var spectrumFast = new Complex[samples.Length];
            samples.CopyTo(spectrumFast, 0);
            fast(spectrumFast);

            AssertHelpers.AlmostEqualList(spectrumNaive, spectrumFast, maximumError);
        }
开发者ID:hickford,项目名称:mathnet-numerics-native,代码行数:21,代码来源:MatchingNaiveTransformTest.cs

示例2: Verify

        static void Verify(
            Complex[] samples,
            int maximumErrorDecimalPlaces,
            FourierOptions options,
            Func<Complex[], FourierOptions, Complex[]> naive,
            Action<Complex[], FourierOptions> fast)
        {
            var spectrumNaive = naive(samples, options);

            var spectrumFast = new Complex[samples.Length];
            samples.CopyTo(spectrumFast, 0);
            fast(spectrumFast, options);

            AssertHelpers.AlmostEqual(spectrumNaive, spectrumFast, maximumErrorDecimalPlaces);
        }
开发者ID:larzw,项目名称:mathnet-numerics,代码行数:15,代码来源:MatchingNaiveTransformTest.cs

示例3: FastTransform

        /// <summary>
        /// Возвращает спектр сигнала, вычесленное по быстрому алгоритму фурье
        /// </summary>
        /// <param name="input">Массив значений сигнала</param>
        /// <returns>Массив со значениями спектра сигнала</returns>
        public static Complex[] FastTransform(Complex[] input)
        {
            double log = Math.Log(input.Length, 2);
            Complex[] x;

            if (log - Math.Round(log) != 0)
            {
                x = new Complex[(int) Math.Pow(2,(int)log + 1)];
                input.CopyTo(x, 0);
            }
            else
            {
                x = (Complex[]) input.Clone();
            }

            Complex[] X;
            int N = x.Length;
            if (N == 2)
            {
                X = new Complex[2];
                X[0] = x[0] + x[1];
                X[1] = x[0] - x[1];
            }
            else
            {
                Complex[] x_even = new Complex[N / 2];
                Complex[] x_odd = new Complex[N / 2];
                for (int i = 0; i < N / 2; i++)
                {
                    x_even[i] = x[2 * i];
                    x_odd[i] = x[2 * i + 1];
                }
                Complex[] X_even = UnsafeFastTransform(x_even);
                Complex[] X_odd = UnsafeFastTransform(x_odd);
                X = new Complex[N];
                for (int i = 0; i < N / 2; i++)
                {
                    X[i] = X_even[i] + Module(i, N) * X_odd[i];
                    X[i + N / 2] = X_even[i] - Module(i, N) * X_odd[i];
                }
            }

            return X;
        }
开发者ID:Kovnir,项目名称:ImageEditor,代码行数:49,代码来源:Fourier.cs

示例4: VerifyMatchesNaiveComplex

        /// <summary>
        /// Verify matches naive complex.
        /// </summary>
        static void VerifyMatchesNaiveComplex(
            Complex[] samples,
            int maximumErrorDecimalPlaces,
            Func<Complex[], Complex[]> naive,
            Action<Complex[]> fast)
        {
            var spectrumNaive = naive(samples);

            var spectrumFast = new Complex[samples.Length];
            samples.CopyTo(spectrumFast, 0);
            fast(spectrumFast);

            AssertHelpers.ListAlmostEqual(spectrumNaive, spectrumFast, maximumErrorDecimalPlaces);
        }
开发者ID:rookboom,项目名称:mathnet-numerics,代码行数:17,代码来源:MatchingNaiveTransformTest.cs

示例5: VerifyInplace

        static void VerifyInplace(
            Complex[] samples,
            int maximumErrorDecimalPlaces,
            FourierOptions options,
            Action<Complex[], FourierOptions> expected,
            Action<Complex[], FourierOptions> actual)
        {
            var spectrumExpected = new Complex[samples.Length];
            samples.CopyTo(spectrumExpected, 0);
            expected(spectrumExpected, options);

            var spectrumActual = new Complex[samples.Length];
            samples.CopyTo(spectrumActual, 0);
            actual(spectrumActual, options);

            AssertHelpers.AlmostEqual(spectrumExpected, spectrumActual, maximumErrorDecimalPlaces);
        }
开发者ID:RVShershnev,项目名称:mathnet-numerics,代码行数:17,代码来源:MatchingNaiveTransformTest.cs

示例6: Furie

        public static Complex[] Furie(Complex[] array)
        {
            int m = Convert.ToInt32(Math.Ceiling(Math.Log(array.Length) / Math.Log(2))); // n=2**m
            int n = Convert.ToInt32( Math.Pow( 2.0, m ) );
            //MessageBox.Show(" n =  " + n + " m =  " + m);

            Complex[] a = new Complex[n];
            array.CopyTo(a, 0);

            Complex u, w, t;
            int i, j, ip, l;

            int n1 = n >> 1;
            int k = n1;
            for (i = 0, j = 0; i < n - 1; i++, j = j + k)
            {
                if (i < j)
                {
                    t = a[j];
                    a[j] = a[i];
                    a[i] = t;
                }
                k = n1;
                while (k <= j)
                {
                    j = j - k;
                    k = k >> 1;
                }
            }
            for (l = 1; l <= m; l++)
            {
                int ll = Convert.ToInt32( Math.Pow( 2.0, l ) );
                int ll1 = ll >> 1;
                u = new Complex(1.0, 0.0);
                w = new Complex(Math.Cos(Math.PI / ll1), Math.Sin(Math.PI / ll1));
                for (j = 1; j <= ll1; j++)
                {
                    for (i = j - 1; i < n; i = i + ll)
                    {
                        ip = i + ll1;
                        t = a[ip]*u;
                        a[ip] = a[i] - t;
                        a[i] = a[i] + t;
                    }
                    u = u*w;
                }
            }

            for (i = 0; i < array.Length; i++)
            {
                array[i] = a[i] / Math.Sqrt(n);

            }

            return array;
        }
开发者ID:interferometry7,项目名称:interferometry,代码行数:56,代码来源:Furie.cs


注:本文中的Complex.CopyTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。