func _TestMultSymmLowerSmall(t *testing.T) { //bM := 5 bN := 7 bP := 7 Adata := [][]float64{ []float64{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, []float64{1.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0}, []float64{1.0, 2.0, 3.0, 0.0, 0.0, 0.0, 0.0}, []float64{1.0, 2.0, 3.0, 4.0, 0.0, 0.0, 0.0}, []float64{1.0, 2.0, 3.0, 4.0, 5.0, 0.0, 0.0}, []float64{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 0.0}, []float64{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0}} A := matrix.FloatMatrixFromTable(Adata, matrix.RowOrder) B := matrix.FloatNormal(bN, bP) C0 := matrix.FloatZeros(bN, bP) C1 := matrix.FloatZeros(bN, bP) Ar := A.FloatArray() Br := B.FloatArray() C1r := C1.FloatArray() blas.SymmFloat(A, B, C0, 1.0, 1.0, linalg.OptLower, linalg.OptRight) DMultSymm(C1r, Ar, Br, 1.0, 1.0, LOWER|RIGHT, bN, A.LeadingIndex(), bN, bN, 0, bP, 0, bN, 2, 2, 2) ok := C0.AllClose(C1) t.Logf("C0 == C1: %v\n", ok) if !ok { t.Logf("A=\n%v\n", A) t.Logf("blas: C=A*B\n%v\n", C0) t.Logf("C1: C1 = A*X\n%v\n", C1) } }
func CTestBlasUp(m, n, p int) (fnc func(), A, B, C *matrix.FloatMatrix) { A = matrix.FloatNormalSymmetric(m, matrix.Lower) B = matrix.FloatNormal(m, n) C = matrix.FloatZeros(m, n) fnc = func() { blas.SymmFloat(A, B, C, 1.0, 1.0, linalg.OptUpper) } return fnc, A, B, C }
func _TestMultSymmLower(t *testing.T) { //bM := 5 bN := 100 * N bP := 100 * P A := matrix.FloatNormalSymmetric(bN, matrix.Lower) B := matrix.FloatNormal(bN, bP) C0 := matrix.FloatZeros(bN, bP) C1 := matrix.FloatZeros(bN, bP) Ar := A.FloatArray() Br := B.FloatArray() C1r := C1.FloatArray() blas.SymmFloat(A, B, C0, 1.0, 1.0, linalg.OptLower) DMultSymm(C1r, Ar, Br, 1.0, 1.0, LOWER|LEFT, bN, A.LeadingIndex(), bN, bN, 0, bP, 0, bN, 32, 32, 32) t.Logf("C0 == C1: %v\n", C0.AllClose(C1)) }
func CheckLower(A, B, C *matrix.FloatMatrix) { blas.SymmFloat(A, B, C, 1.0, 1.0, linalg.OptLower) }
func CheckNormal(A, B, C *matrix.FloatMatrix) { blas.SymmFloat(A, B, C, 1.0, 1.0, linalg.OptUpper) }