Пример #1
0
func randMat(m, n int) *mat.Mat {
	// Random symmetric positive definite matrix.
	a := mat.New(m, n)
	for i := 0; i < m; i++ {
		for j := 0; j < n; j++ {
			a.Set(i, j, rand.NormFloat64())
		}
	}
	return a
}
Пример #2
0
// Extracts the imaginary part of a complex matrix.
func Imag(a Const) *mat.Mat {
	m, n := a.Dims()
	b := mat.New(m, n)
	for i := 0; i < m; i++ {
		for j := 0; j < n; j++ {
			b.Set(i, j, imag(a.At(i, j)))
		}
	}
	return b
}