示例#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
文件: cmplx.go 项目: jvlmdr/lin-go
// 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
}