mirror of
https://github.com/gonum/gonum.git
synced 2025-10-30 18:16:32 +08:00
matrix/mat64: provide sugar for easy matrix extraction
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user