コード例 #1
0
 public static FftwPlan DftC2r(int[] n, out FftwArray inArray, out FftwArray outArray,
                               FftwFlags flags = FftwFlags.FFTW_MEASURE)
 {
     inArray  = new FftwArray(DftComplexLength(n));
     outArray = new FftwArray(DftRealLength(n));
     return(DftC2r(n, inArray, outArray, flags));
 }
コード例 #2
0
 public static FftwPlan DftC2r3D(int n0, int n1, int n2, out FftwArray inArray, out FftwArray outArray,
                                 FftwFlags flags = FftwFlags.FFTW_MEASURE)
 {
     inArray  = new FftwArray(DftComplexLength(n0, n1, n2));
     outArray = new FftwArray(DftRealLength(n0, n1, n2));
     return(DftC2r3D(n0, n1, n2, inArray, outArray, flags));
 }
コード例 #3
0
 private static void ValidateArray(FftwArray array, int length, string argument)
 {
     if (array.Length < length)
     {
         throw new ArgumentException($"Array length must be at least {length}.", argument);
     }
 }
コード例 #4
0
        public static FftwPlan DftR2r3D(int n0, int n1, int n2, out FftwArray inArray, out FftwArray outArray,
                                        FftwR2rKind kind0, FftwR2rKind kind1, FftwR2rKind kind2, FftwFlags flags = FftwFlags.FFTW_MEASURE)
        {
            int length = R2rLength(n0, n1, n2, kind0, kind1, kind2);

            inArray  = new FftwArray(length);
            outArray = new FftwArray(length);
            return(DftR2r3D(n0, n1, n2, inArray, outArray, kind0, kind1, kind2, flags));
        }
コード例 #5
0
        public static FftwPlan Dft(int[] n, out FftwArray inArray, out FftwArray outArray,
                                   FftwSign sign = FftwSign.FFTW_FORWARD, FftwFlags flags = FftwFlags.FFTW_MEASURE)
        {
            int length = DftLength(n);

            inArray  = new FftwArray(length);
            outArray = new FftwArray(length);
            return(Dft(n, inArray, outArray, sign, flags));
        }
コード例 #6
0
        public static FftwPlan DftR2r3D(int n0, int n1, int n2, FftwArray inArray, FftwArray outArray,
                                        FftwR2rKind kind0, FftwR2rKind kind1, FftwR2rKind kind2, FftwFlags flags = FftwFlags.FFTW_MEASURE)
        {
            int length = R2rLength(n0, n1, n2, kind0, kind1, kind2);

            ValidateArray(inArray, length, nameof(inArray));
            ValidateArray(outArray, length, nameof(outArray));
            return(new FftwPlan(flags,
                                fftw_plan_r2r_3d(n0, n1, n2,
                                                 inArray.Pointer, outArray.Pointer,
                                                 kind0, kind1, kind2, (uint_t)flags),
                                inArray, outArray));
        }
コード例 #7
0
        public static FftwPlan DftC2r(int[] n, FftwArray inArray, FftwArray outArray,
                                      FftwFlags flags = FftwFlags.FFTW_MEASURE)
        {
            int inLength  = DftComplexLength(n);
            int outLength = IsInPlace(inArray, outArray) ? inLength : DftRealLength(n);

            ValidateArray(inArray, outLength, nameof(inArray));
            ValidateArray(outArray, inLength, nameof(outArray));
            return(new FftwPlan(flags,
                                fftw_plan_dft_c2r(n.Length, n,
                                                  inArray.Pointer, outArray.Pointer,
                                                  (uint_t)flags),
                                inArray, outArray));
        }
コード例 #8
0
        public static FftwPlan DftR2c3D(int n0, int n1, int n2, FftwArray inArray, FftwArray outArray,
                                        FftwFlags flags = FftwFlags.FFTW_MEASURE)
        {
            int outLength = DftComplexLength(n0, n1, n2);
            int inLength  = IsInPlace(inArray, outArray) ? outLength : DftRealLength(n0, n1, n2);

            ValidateArray(inArray, inLength, nameof(inArray));
            ValidateArray(outArray, outLength, nameof(outArray));
            return(new FftwPlan(flags,
                                fftw_plan_dft_r2c_3d(n0, n1, n2,
                                                     inArray.Pointer, outArray.Pointer,
                                                     (uint_t)flags),
                                inArray, outArray));
        }
コード例 #9
0
        public static FftwPlan Dft(int[] n, FftwArray inArray, FftwArray outArray,
                                   FftwSign sign = FftwSign.FFTW_FORWARD, FftwFlags flags = FftwFlags.FFTW_MEASURE)
        {
            int length = DftLength(n);

            ValidateSign(sign);
            ValidateArray(inArray, length, nameof(inArray));
            ValidateArray(outArray, length, nameof(outArray));
            return(new FftwPlan(flags,
                                fftw_plan_dft(n.Length, n,
                                              inArray.Pointer, outArray.Pointer,
                                              (int_t)sign, (uint_t)flags),
                                inArray, outArray));
        }
コード例 #10
0
 public static FftwPlan DftR2r2D(int n0, int n1, out FftwArray ioArray,
                                 FftwR2rKind kind0, FftwR2rKind kind1, FftwFlags flags = FftwFlags.FFTW_MEASURE)
 {
     ioArray = new FftwArray(R2rLength(n0, n1, kind0, kind1));
     return(DftR2r2D(n0, n1, ioArray, ioArray, kind0, kind1, flags));
 }
コード例 #11
0
 public static FftwPlan DftC2r2D(int n0, int n1, out FftwArray ioArray,
                                 FftwFlags flags = FftwFlags.FFTW_MEASURE)
 {
     ioArray = new FftwArray(DftComplexLength(n0, n1));
     return(DftC2r2D(n0, n1, ioArray, ioArray, flags));
 }
コード例 #12
0
 public static FftwPlan DftR2c(int[] n, out FftwArray ioArray,
                               FftwFlags flags = FftwFlags.FFTW_MEASURE)
 {
     ioArray = new FftwArray(DftComplexLength(n));
     return(DftR2c(n, ioArray, ioArray, flags));
 }
コード例 #13
0
 public static FftwPlan Dft(int[] n, out FftwArray ioArray,
                            FftwSign sign = FftwSign.FFTW_FORWARD, FftwFlags flags = FftwFlags.FFTW_MEASURE)
 {
     ioArray = new FftwArray(DftLength(n));
     return(Dft(n, ioArray, ioArray, sign, flags));
 }
コード例 #14
0
 public static FftwPlan Dft3D(int n0, int n1, int n2, out FftwArray ioArray,
                              FftwSign sign = FftwSign.FFTW_FORWARD, FftwFlags flags = FftwFlags.FFTW_MEASURE)
 {
     ioArray = new FftwArray(DftLength(n0, n1, n2));
     return(Dft3D(n0, n1, n2, ioArray, ioArray, sign, flags));
 }
コード例 #15
0
 private static bool IsInPlace(FftwArray inArray, FftwArray outArray) =>
 inArray.Pointer == outArray.Pointer;