// Zrdesamp performs a complex-real downsample with anti-aliasing. func Zrdesamp(input DSPSplitComplex, decimationFactor int, coefficients []float32, output DSPSplitComplex) { var srcC C.DSPSplitComplex srcC.realp = (*C.float)(&input.Real[0]) srcC.imagp = (*C.float)(&input.Imag[0]) var dstC C.DSPSplitComplex dstC.realp = (*C.float)(&output.Real[0]) dstC.imagp = (*C.float)(&output.Imag[0]) C.vDSP_zrdesamp(&srcC, C.vDSP_Stride(decimationFactor), (*C.float)(&coefficients[0]), &dstC, C.vDSP_Length(len(output.Real)), C.vDSP_Length(len(coefficients))) }
// Zop computes an out-of-place single-precision complex discrete Fourier transform of the // input vector, either from the time domain to the frequency domain (forward) or from the // frequency domain to the time domain (inverse). func (fs *FFTSetup) Zop(input DSPSplitComplex, inputStride int, output DSPSplitComplex, outputStride int, log2n int, direction FFTDirection) { var inC C.DSPSplitComplex inC.realp = (*C.float)(&input.Real[0]) inC.imagp = (*C.float)(&input.Imag[0]) var outC C.DSPSplitComplex outC.realp = (*C.float)(&output.Real[0]) outC.imagp = (*C.float)(&output.Imag[0]) C.vDSP_fft_zop(fs.cFFTSetup, &inC, C.vDSP_Stride(inputStride), &outC, C.vDSP_Stride(outputStride), C.vDSP_Length(log2n), C.FFTDirection(direction)) }
// Zvcmul performs a complex vector conjugate and multiply. func Zvcmul(input1 DSPSplitComplex, stride1 int, input2 DSPSplitComplex, stride2 int, result DSPSplitComplex, resultStride int) { var in1 C.DSPSplitComplex in1.realp = (*C.float)(&input1.Real[0]) in1.imagp = (*C.float)(&input1.Imag[0]) var in2 C.DSPSplitComplex in2.realp = (*C.float)(&input2.Real[0]) in2.imagp = (*C.float)(&input2.Imag[0]) var res C.DSPSplitComplex res.realp = (*C.float)(&result.Real[0]) res.imagp = (*C.float)(&result.Imag[0]) C.vDSP_zvcmul(&in1, C.vDSP_Stride(stride1), &in2, C.vDSP_Stride(stride2), &res, C.vDSP_Stride(resultStride), minLen(len(input1.Real)/stride1, len(input2.Real)/stride2, len(result.Real)/resultStride)) }
// Zidotpr calculates the conjugate dot product (or inner dot product) of complex vectors A and B and leave the result in complex vector C; single precision. func Zidotpr(input1 DSPSplitComplex, stride1 int, input2 DSPSplitComplex, stride2 int, result DSPSplitComplex) { var in1 C.DSPSplitComplex in1.realp = (*C.float)(&input1.Real[0]) in1.imagp = (*C.float)(&input1.Imag[0]) var in2 C.DSPSplitComplex in2.realp = (*C.float)(&input2.Real[0]) in2.imagp = (*C.float)(&input2.Imag[0]) var res C.DSPSplitComplex res.realp = (*C.float)(&result.Real[0]) res.imagp = (*C.float)(&result.Imag[0]) C.vDSP_zidotpr(&in1, C.vDSP_Stride(stride1), &in2, C.vDSP_Stride(stride2), &res, C.vDSP_Length(len(result.Real))) }
// Ctoz copies the contents of an interleaved complex vector C to a split complex vector Z; single precision. func Ctoz(input []complex64, inputStride int, output DSPSplitComplex, outputStride int) { var splitComplex C.DSPSplitComplex splitComplex.realp = (*C.float)(&output.Real[0]) splitComplex.imagp = (*C.float)(&output.Imag[0]) n := 2 * len(output.Real) / outputStride if n2 := 2 * len(input) / inputStride; n2 < n { n = n2 } C.vDSP_ctoz((*C.DSPComplex)(unsafe.Pointer(&input[0])), C.vDSP_Stride(inputStride), &splitComplex, C.vDSP_Stride(outputStride), C.vDSP_Length(n)) }
// Zvabs calculates the absolute values of all values in the complex input. func Zvabs(input DSPSplitComplex, inputStride int, output []float32, outputStride int) { var in C.DSPSplitComplex in.realp = (*C.float)(&input.Real[0]) in.imagp = (*C.float)(&input.Imag[0]) C.vDSP_zvabs(&in, C.vDSP_Stride(inputStride), (*C.float)(&output[0]), C.vDSP_Stride(outputStride), C.vDSP_Length(len(output)/outputStride)) }
// Zvphas calculates the complex vector phase. func Zvphas(input DSPSplitComplex, inputStride int, output []float32, outputStride int) { var srcC C.DSPSplitComplex srcC.realp = (*C.float)(&input.Real[0]) srcC.imagp = (*C.float)(&input.Imag[0]) C.vDSP_zvphas(&srcC, C.vDSP_Stride(inputStride), (*C.float)(&output[0]), C.vDSP_Stride(outputStride), C.vDSP_Length(len(output))) }
// Ztoc_byte copies the contents of a split complex vector Z to an interleaved complex vector C; single precision. Operate on a byte buffer which contains complex64 func Ztoc_byte(input DSPSplitComplex, inputStride int, output []byte, outputStride int) { var splitComplex C.DSPSplitComplex splitComplex.realp = (*C.float)(&input.Real[0]) splitComplex.imagp = (*C.float)(&input.Imag[0]) C.vDSP_ztoc(&splitComplex, C.vDSP_Stride(inputStride), (*C.DSPComplex)(unsafe.Pointer(&output[0])), C.vDSP_Stride(outputStride), C.vDSP_Length(len(output)/4/outputStride)) }
// Zip computess an in-place single-precision complex discrete Fourier transform of the // input/output vector signal, either from the time domain to the frequency domain // (forward) or from the frequency domain to the time domain (inverse). func (fs *FFTSetup) Zip(ioData DSPSplitComplex, stride, log2n int, direction FFTDirection) { var splitComplex C.DSPSplitComplex splitComplex.realp = (*C.float)(&ioData.Real[0]) splitComplex.imagp = (*C.float)(&ioData.Imag[0]) C.vDSP_fft_zip(fs.cFFTSetup, &splitComplex, C.vDSP_Stride(stride), C.vDSP_Length(log2n), C.FFTDirection(direction)) }