matrix/mat64: provide sugar for easy matrix extraction

This commit is contained in:
kortschak
2017-05-27 08:05:00 +09:30
committed by Dan Kortschak
parent 15641d34f4
commit 67bc20e87d
14 changed files with 166 additions and 80 deletions

View File

@@ -23,15 +23,13 @@ func TestLUD(t *testing.T) {
var lu LU
lu.Factorize(a)
var l, u TriDense
lu.LTo(&l)
lu.UTo(&u)
l := lu.LTo(nil)
u := lu.UTo(nil)
var p Dense
pivot := lu.Pivot(nil)
p.Permutation(n, pivot)
var got Dense
got.Mul(&p, &l)
got.Mul(&got, &u)
got.Product(&p, l, u)
if !EqualApprox(&got, &want, 1e-12) {
t.Errorf("PLU does not equal original matrix.\nWant: %v\n Got: %v", want, got)
}