Ejemplo n.º 1
0
func PlanDft2d(in, out [][]complex128, dir Direction, flag Flag) *Plan {
	// TODO: check that in and out have the same dimensions
	fftw_in := (*C.fftw_complex)((unsafe.Pointer)(&in[0][0]))
	fftw_out := (*C.fftw_complex)((unsafe.Pointer)(&out[0][0]))
	p := C.fftw_plan_dft_2d((C.int)(len(in)), (C.int)(len(in[0])), fftw_in, fftw_out, C.int(dir), C.uint(flag))
	return newPlan(p)
}
Ejemplo n.º 2
0
Archivo: fftw.go Proyecto: delfvad/hi
// New fftw plan. Destroy() after use.
func New(data [][]complex128) *Plan {
	pData := (unsafe.Pointer)(&data[0][0])
	return &Plan{
		fftwP: C.fftw_plan_dft_2d(
			(C.int)(len(data)),       // nrows
			(C.int)(len(data[0])),    // ncolumns
			(*C.fftw_complex)(pData), // input slice
			(*C.fftw_complex)(pData), // output slice
			C.int(C.FFTW_FORWARD),
			C.uint(C.FFTW_ESTIMATE)),
	}
}
Ejemplo n.º 3
0
func NewPlan2(in, out *Array2, dir Direction, flag Flag) *Plan {
	// TODO: check that in and out have the same dimensions
	n0, n1 := in.Dims()
	var (
		n0_   = C.int(n0)
		n1_   = C.int(n1)
		in_   = (*C.fftw_complex)(unsafe.Pointer(in.ptr()))
		out_  = (*C.fftw_complex)(unsafe.Pointer(out.ptr()))
		dir_  = C.int(dir)
		flag_ = C.uint(flag)
	)
	p := C.fftw_plan_dft_2d(n0_, n1_, in_, out_, dir_, flag_)
	return &Plan{p}
}