Exemple #1
0
// Assumes that f is no smaller than x.
func copyRealToChannel(f *rimg64.Multi, p int, x *fftw.Array2) {
	for u := 0; u < f.Width; u++ {
		for v := 0; v < f.Height; v++ {
			f.Set(u, v, p, real(x.At(u, v)))
		}
	}
}
Exemple #2
0
// Assumes that f is no smaller than x.
func copyRealTo(f *rimg64.Image, x *fftw.Array2) {
	for u := 0; u < f.Width; u++ {
		for v := 0; v < f.Height; v++ {
			f.Set(u, v, real(x.At(u, v)))
		}
	}
}
Exemple #3
0
// ai <- k ai
func scale(k complex128, c *fftw.Array2) {
	m, n := c.Dims()
	for i := 0; i < m; i++ {
		for j := 0; j < n; j++ {
			c.Set(i, j, k*c.At(i, j))
		}
	}
}
Exemple #4
0
// ci <- k conj(ai) bi
func scaleMul(c *fftw.Array2, k complex128, a, b *fftw.Array2) {
	m, n := a.Dims()
	for i := 0; i < m; i++ {
		for j := 0; j < n; j++ {
			ax := cmplx.Conj(a.At(i, j))
			bx := b.At(i, j)
			c.Set(i, j, k*ax*bx)
		}
	}
}
Exemple #5
0
// ci <- ci + conj(ai) bi
func addMul(c *fftw.Array2, a, b *fftw.Array2) {
	m, n := a.Dims()
	for i := 0; i < m; i++ {
		for j := 0; j < n; j++ {
			ax := cmplx.Conj(a.At(i, j))
			bx := b.At(i, j)
			cx := c.At(i, j)
			c.Set(i, j, cx+ax*bx)
		}
	}
}