Example #1
0
func __TestZeroQRSweep(t *testing.T) {

	N := 5
	D0 := cmat.NewMatrix(1, N)
	E0 := cmat.NewMatrix(1, N-1)
	D1 := cmat.NewMatrix(1, N)
	E1 := cmat.NewMatrix(1, N-1)

	for k := 0; k < N; k++ {
		D0.SetAt(k, float64(k+1))
		D1.SetAt(k, float64(k+1))
		if k < N-1 {
			E0.SetAt(k, 1.0)
			E1.SetAt(k, 1.0)
		}
	}

	f := D0.GetAt(0)
	g := E0.GetAt(0)
	lapackd.BDQRsweep(D0, E0, f, g)
	lapackd.BDQRzero(D1, E1)
	t.Logf("D0.std :%v\n", D0)
	t.Logf("D1.zero:%v\n", D1)
	t.Logf("E0.std :%v\n", E0)
	t.Logf("E1:zero %v\n", E1)
}
Example #2
0
func __TestSweep(t *testing.T) {

	N := 5
	D0 := cmat.NewMatrix(1, N)
	E0 := cmat.NewMatrix(1, N-1)
	D1 := cmat.NewMatrix(1, N)
	E1 := cmat.NewMatrix(1, N-1)

	for k := 0; k < N; k++ {
		D0.SetAt(k, float64(k+1))
		D1.SetAt(N-1-k, float64(k+1))
		if k < N-1 {
			E0.SetAt(k, 1.0)
			E1.SetAt(k, 1.0)
		}
	}

	f := 0.5
	g := -0.45
	lapackd.BDQRsweep(D0, E0, f, g)
	lapackd.BDQLsweep(D1, E1, f, g)
	t.Logf("D0:%v\n", D0)
	t.Logf("D1:%v\n", D1)
	t.Logf("E0:%v\n", E0)
	t.Logf("E1:%v\n", E1)
}