Beispiel #1
0
func TestTrsmBig(t *testing.T) {
	bN := 900
	nP := 40
	nb := 16
	L := matrix.FloatNormalSymmetric(bN, matrix.Lower)
	U := matrix.FloatNormalSymmetric(bN, matrix.Upper)
	_, _ = L, U

	t.Logf("-- BLK TRSM-UPPER, LEFT, NON_UNIT --")
	trsmSolve(t, U, UPPER|LEFT, false, nP, nb)
	t.Logf("-- BLK TRSM-UPPER, LEFT, UNIT --")
	trsmSolve(t, U, UPPER|LEFT|UNIT, false, nP, nb)

	t.Logf("-- BLK TRSM-LOWER, LEFT, NON_UNIT --")
	trsmSolve(t, L, LOWER|LEFT, false, nP, nb)
	t.Logf("-- BLK TRSM-LOWER, LEFT, UNIT --")
	trsmSolve(t, L, LOWER|LEFT|UNIT, false, nP, nb)

	t.Logf("-- BLK TRSM-UPPER, LEFT, TRANSA, NON_UNIT --")
	trsmSolve(t, U, UPPER|LEFT|TRANSA, false, nP, nb)
	t.Logf("-- BLK TRSM-UPPER, LEFT, TRANSA, UNIT --")
	trsmSolve(t, U, UPPER|LEFT|TRANSA|UNIT, false, nP, nb)

	t.Logf("-- BLK TRSM-LOWER, LEFT, TRANSA, NON_UNIT --")
	trsmSolve(t, L, LOWER|LEFT|TRANSA, false, nP, nb)
	t.Logf("-- BLK TRSM-LOWER, LEFT, TRANSA, UNIT --")
	trsmSolve(t, L, LOWER|LEFT|TRANSA|UNIT, false, nP, nb)

	t.Logf("-- BLK TRSM-UPPER, RIGHT, NON_UNIT --")
	trsmSolve(t, U, UPPER|RIGHT, false, nP, nb)
	t.Logf("-- BLK TRSM-UPPER, RIGHT, UNIT --")
	trsmSolve(t, U, UPPER|UNIT|RIGHT, false, nP, nb)

	t.Logf("-- BLK TRSM-LOWER, RIGHT, NON-UNIT --")
	trsmSolve(t, L, LOWER|RIGHT, false, nP, nb)
	t.Logf("-- BLK TRSM-LOWER, RIGHT, UNIT --")
	trsmSolve(t, L, LOWER|UNIT|RIGHT, false, nP, nb)

	t.Logf("-- BLK TRSM-UPPER, RIGHT, TRANSA, NON_UNIT --")
	trsmSolve(t, U, UPPER|RIGHT|TRANSA, false, nP, nb)
	t.Logf("-- BLK TRSM-UPPER, RIGHT, TRANSA, UNIT --")
	trsmSolve(t, U, UPPER|RIGHT|TRANSA|UNIT, false, nP, nb)

	nb = 0
	t.Logf("-- BLK TRSM-LOWER, RIGHT, TRANSA, NON_UNIT --")
	trsmSolve(t, L, LOWER|RIGHT|TRANSA, false, nP, nb)
	t.Logf("-- BLK TRSM-LOWER, RIGHT, TRANSA, UNIT --")
	trsmSolve(t, L, LOWER|RIGHT|TRANSA|UNIT, false, nP, nb)

}
Beispiel #2
0
func TestTrsmUnblk(t *testing.T) {
	//bN := 7
	Udata3 := [][]float64{
		[]float64{2.0, 2.0, 2.0},
		[]float64{0.0, 3.0, 3.0},
		[]float64{0.0, 0.0, 4.0}}
	U3 := matrix.FloatMatrixFromTable(Udata3, matrix.RowOrder)
	_ = U3

	Ldata3 := [][]float64{
		[]float64{1.0, 0.0, 0.0},
		[]float64{1.0, 2.0, 0.0},
		[]float64{1.0, 2.0, 3.0}}
	L3 := matrix.FloatMatrixFromTable(Ldata3, matrix.RowOrder)
	_ = L3

	bN := 10
	nP := 7
	nb := 4
	L := matrix.FloatNormalSymmetric(bN, matrix.Lower)

	//t.Logf("-- TRSM-UPPER, TRANS, RIGHT, NON_UNIT --")
	//trsmSolve(t, U3, UPPER|TRANSA|RIGHT, false, 2, 0)
	//t.Logf("-- TRSM-UPPER, TRANS, RIGHT, UNIT --")
	//trsmSolve(t, U3, UPPER|TRANSA|UNIT|RIGHT, false, 2, 0)

	t.Logf("-- UNBLK TRSM-LOWER, TRANS, RIGHT, NON-UNIT --")
	trsmSolve(t, L, LOWER|TRANSA|RIGHT, false, nP, 0)
	t.Logf("-- BLK   TRSM-LOWER, TRANS, RIGHT, NON-UNIT --")
	trsmSolve(t, L, LOWER|TRANSA|RIGHT, false, nP, nb)

}
Beispiel #3
0
func CTestSymmLower(m, n, p int) (fnc func(), A, B, C *matrix.FloatMatrix) {
	A = matrix.FloatNormalSymmetric(m, matrix.Upper)
	B = matrix.FloatNormal(m, n)
	C = matrix.FloatZeros(m, n)
	fnc = func() {
		matops.MultSym(C, A, B, 1.0, 1.0, matops.LEFT|matops.LOWER)
	}
	return fnc, A, B, C
}
Beispiel #4
0
func TestTemplate(m, n, p int) (fnc func(), A, B, C *matrix.FloatMatrix) {
	A = matrix.FloatNormalSymmetric(m, matrix.Upper)
	B = matrix.FloatNormal(m, n)
	C = matrix.FloatZeros(m, n)
	fnc = func() {
		// test core here
	}
	return
}
Beispiel #5
0
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
}
Beispiel #6
0
func _TestSolveRandom(t *testing.T) {
	bN := 22
	nb := 4
	L := matrix.FloatNormalSymmetric(bN, matrix.Lower)
	U := L.Transpose()
	X0 := matrix.FloatWithValue(L.Rows(), 1, 1.0)

	t.Logf("-- BLOCKED SOLVE LOWER NON-UNIT ---\n")
	solveMVTest(t, L, X0.Copy(), LOWER, bN, nb)
	t.Logf("-- BLOCKED SOLVE LOWER UNIT ---\n")
	solveMVTest(t, L, X0.Copy(), LOWER|UNIT, bN, nb)
	t.Logf("-- BLOCKED SOLVE UPPER NON-UNIT ---\n")
	solveMVTest(t, U, X0.Copy(), UPPER, bN, nb)
	t.Logf("-- BLOCKED SOLVE UPPER UNIT ---\n")
	solveMVTest(t, U, X0.Copy(), UPPER|UNIT, bN, nb)
}
Beispiel #7
0
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))
}