Example #1
0
 private static DataVector32 NewGenericVector(
     bool isComplex,
     VectorDomain domain,
     float initValue,
     int length,
     float delta = 1.0f,
     PerformanceSettings performanceSettings = null)
 {
     RejectIf(length < 0, nameof(length), "Vector length must be >= 0");
     DataVector32Native.DataVector32Struct *native;
     if (performanceSettings == null)
     {
         native = DataVector32Native.New(
             isComplex ? Complex : Real,
             (int)domain,
             initValue,
             (ulong)length,
             delta);
     }
     else
     {
         native = DataVector32Native.New(
             isComplex ? Complex : Real,
             (int)domain,
             initValue,
             (ulong)length,
             delta,
             (ulong)performanceSettings.CoreLimit,
             performanceSettings.EarlyTempAllocation);
     }
     return(new DataVector32(native));
 }
Example #2
0
        public static IComplexFrequencyDomainVector32 NewComplexFrequencyVectorFromInterleaved(float[] data, PerformanceSettings performanceSettings = null)
        {
            var vector = NewGenericVector(true, VectorDomain.Frequency, 0.0f, data.Length, performanceSettings: performanceSettings);

            for (int i = 0; i < data.Length; i++)
            {
                vector[i] = data[i];
            }

            return(vector);
        }
Example #3
0
        public static IComplexFrequencyDomainVector32 NewComplexFrequencyVectorFromRealAndImag(float[] real, float[] imag, PerformanceSettings performanceSettings = null)
        {
            RejectIf(real.Length != imag.Length, nameof(imag), "Real and imag need to have the same length");
            var vector = NewGenericVector(true, VectorDomain.Frequency, 0.0f, 2 * real.Length, performanceSettings: performanceSettings);

            for (int i = 0; i < real.Length; i++)
            {
                vector[2 * i]     = real[i];
                vector[2 * i + 1] = imag[i];
            }

            return(vector);
        }
Example #4
0
        public static IComplexFrequencyDomainVector32 NewComplexFrequencyVectorFromConstant(Complex32 constant, int points, PerformanceSettings performanceSettings = null)
        {
            RejectIf(points < 0, nameof(points), "Vector length must be >= 0");
            var vector = NewGenericVector(true, VectorDomain.Frequency, 0.0f, 2 * points, performanceSettings: performanceSettings);

            for (int i = 0; i < points; i++)
            {
                vector[2 * i]     = constant.Real;
                vector[2 * i + 1] = constant.Imag;
            }

            return(vector);
        }
Example #5
0
        public static IRealFrequencyDomainVector32 NewRealFrequencyVectorFromArray(float[] data, PerformanceSettings performanceSettings = null)
        {
            var vector = NewGenericVector(false, VectorDomain.Frequency, 0.0f, data.Length, performanceSettings: performanceSettings);

            for (int i = 0; i < data.Length; i++)
            {
                vector[i] = data[i];
            }

            return(vector);
        }
Example #6
0
 public static IRealFrequencyDomainVector32 NewRealFrequencyVectorFromConstant(float constant, int points, PerformanceSettings performanceSettings = null)
 {
     return(NewGenericVector(false, VectorDomain.Frequency, constant, points, performanceSettings: performanceSettings));
 }
Example #7
0
        public static DataVector32 NewGenericVector(bool isComplex, VectorDomain domain, float[] data, PerformanceSettings performanceSettings = null)
        {
            var vector = NewGenericVector(isComplex, domain, 0.0f, data.Length, performanceSettings: performanceSettings);

            for (int i = 0; i < data.Length; i++)
            {
                vector[i] = data[i];
            }

            return(vector);
        }
Example #8
0
 public static DataVector32 NewGenericVector(bool isComplex, VectorDomain domain, int length, PerformanceSettings performanceSettings = null)
 {
     return(NewGenericVector(isComplex, domain, 0.0f, length, performanceSettings: performanceSettings));
 }