func test_trdevd(N, flags, kind int, verbose bool, t *testing.T) { var At, sD, sE, tmp cmat.FloatMatrix A0 := cmat.NewMatrix(N, N) desc := setTrdDiagonals(A0, kind) At.SubMatrix(A0, 0, 0, N, N) sD.Diag(A0, 0) sE.Diag(A0, 1) D := cmat.NewCopy(&sD) E := cmat.NewCopy(&sE) V := cmat.NewMatrix(N, N) sD.Diag(V, 0) sD.Add(1.0) W := cmat.NewMatrix(4*N, 1) C := cmat.NewMatrix(N, N) if verbose && N < 10 { t.Logf("A0:\n%v\n", A0.ToString("%6.3f")) t.Logf("V.pre:\n%v\n", V.ToString("%6.3f")) } lapackd.TRDEigen(D, E, V, W, flags|gomas.WANTV) for k := 0; k < N-1; k++ { if E.GetAt(k) != 0.0 { t.Logf("E[%d] != 0.0 (%e)\n", k, E.GetAt(k)) } } blasd.Mult(C, V, V, 1.0, 0.0, gomas.TRANSB) sD.Diag(C) sD.Add(-1.0) nrmv := lapackd.NormP(C, lapackd.NORM_ONE) blasd.Mult(C, V, A0, 1.0, 0.0, gomas.TRANSA) blasd.Mult(&At, C, V, 1.0, 0.0, gomas.NONE) if verbose && N < 10 { t.Logf("D:\n%v\n", asRow(&tmp, D).ToString("%6.3f")) t.Logf("V:\n%v\n", V.ToString("%6.3f")) t.Logf("V.T*A*V\n%v\n", At.ToString("%6.3f")) } sD.Diag(&At) blasd.Axpy(&sD, D, -1.0) nrma := lapackd.NormP(&At, lapackd.NORM_ONE) t.Logf("N=%d [%s] ||V.T*A*V - eigen(A)||_1: %e\n", N, desc, nrma) t.Logf(" ||I - V.T*V||_1: %e\n", nrmv) }