|
86 | 86 | u = rand(22)
|
87 | 87 | @test (L + L2) * u ≈ convert(AbstractMatrix,L + L2) * u ≈ (BandedMatrix(L) + BandedMatrix(L2)) * u
|
88 | 88 |
|
89 |
| - # Test concretization |
90 |
| - @test Array(A)[1] ≈ (Array(L)*Array(Q,N)[1], Array(L)*Array(Q,N)[2])[1] |
91 |
| - @test Array(A)[2] ≈ (Array(L)*Array(Q,N)[1], Array(L)*Array(Q,N)[2])[2] |
92 |
| - @test SparseMatrixCSC(A)[1] ≈ (SparseMatrixCSC(L)*SparseMatrixCSC(Q,N)[1], SparseMatrixCSC(L)*SparseMatrixCSC(Q,N)[2])[1] |
93 |
| - @test SparseMatrixCSC(A)[2] ≈ (SparseMatrixCSC(L)*SparseMatrixCSC(Q,N)[1], SparseMatrixCSC(L)*SparseMatrixCSC(Q,N)[2])[2] |
94 |
| - @test sparse(A)[1] ≈ (sparse(L)*sparse(Q,N)[1], sparse(L)*sparse(Q,N)[2])[1] |
95 |
| - @test sparse(A)[2] ≈ (sparse(L)*sparse(Q,N)[1], sparse(L)*sparse(Q,N)[2])[2] |
96 |
| - @test BandedMatrix(A)[1] ≈ (BandedMatrix(L)*BandedMatrix(Q,N)[1], BandedMatrix(L)*BandedMatrix(Q,N)[2])[1] |
97 |
| - @test BandedMatrix(A)[2] ≈ (BandedMatrix(L)*BandedMatrix(Q,N)[1], BandedMatrix(L)*BandedMatrix(Q,N)[2])[2] |
98 |
| - |
99 |
| - # Test that concretization works with multiplication |
100 |
| - u = rand(20) |
101 |
| - @test Array(A)[1]*u + Array(A)[2] ≈ L*(Q*u) ≈ A*u |
102 |
| - @test sparse(A)[1]*u + sparse(A)[2] ≈ L*(Q*u) ≈ A*u |
| 89 | + @testset "$mode concretization" for (mode,Mat) in [("Dense", Array), |
| 90 | + ("Sparse", SparseMatrixCSC), |
| 91 | + ("Best sparse", sparse), |
| 92 | + ("BandedMatrix", BandedMatrix)] |
| 93 | + Am,Au = Mat(A) |
| 94 | + Lm = Mat(L) |
| 95 | + Qm,Qu = Mat(Q,N) |
| 96 | + |
| 97 | + @test Am ≈ Lm*Qm |
| 98 | + @test Au ≈ Lm*Qu |
| 99 | + end |
| 100 | + |
| 101 | + @testset "$mode concrete multiplication" for (mode,Mat) in [("Dense", Array), |
| 102 | + ("Sparse", SparseMatrixCSC), |
| 103 | + ("Best sparse", sparse), |
| 104 | + ("BandedMatrix", BandedMatrix)] |
| 105 | + u = rand(20) |
| 106 | + Am,Au = Mat(A) |
| 107 | + Lm = Mat(L) |
| 108 | + Qm,Qu = Mat(Q,N) |
| 109 | + |
| 110 | + @test Am*u + Au ≈ L*(Q*u) ≈ A*u |
| 111 | + end |
103 | 112 | end
|
104 | 113 |
|
105 | 114 | @testset "Test Left Division L2 (second order)" begin
|
|
0 commit comments