|
147 | 147 | end |
148 | 148 | end |
149 | 149 |
|
| 150 | +@testset "destination array density in solves" begin |
| 151 | + O = diagm(-1 => fill(-1, 9), 0 => fill(2, 10), 1 => fill(-1, 9)) |
| 152 | + wrappers = (a -> Bidiagonal(a, :U), |
| 153 | + a -> Bidiagonal(a, :L), |
| 154 | + a -> SymTridiagonal(2diag(a), -diag(a, 1)), |
| 155 | + a -> Tridiagonal(-diag(a, -1), 2diag(a), -diag(a, 1)), |
| 156 | + LowerTriangular, |
| 157 | + UnitLowerTriangular, |
| 158 | + UpperTriangular, |
| 159 | + UnitUpperTriangular, |
| 160 | + UpperHessenberg) |
| 161 | + for T in wrappers |
| 162 | + A = T(O) |
| 163 | + bs = sprandn(10, 0.3) |
| 164 | + bd = Array(bs) |
| 165 | + x = A \ bs |
| 166 | + @test x ≈ A \ bd |
| 167 | + @test !issparse(x) |
| 168 | + Bs = sprandn(10, 3, 0.2) |
| 169 | + Bd = Matrix(Bs) |
| 170 | + X = A \ Bs |
| 171 | + @test X ≈ A \ Bd |
| 172 | + @test !issparse(X) |
| 173 | + Cs = copy(Bs') |
| 174 | + Cd = Matrix(Cs) |
| 175 | + Y = Cs / A |
| 176 | + @test Y ≈ Cd / A |
| 177 | + @test !issparse(Y) |
| 178 | + end |
| 179 | + b, B = ones(Int, 10), ones(Int, 10, 10) |
| 180 | + for T in (UnitLowerTriangular, UnitUpperTriangular) |
| 181 | + A = T(O) |
| 182 | + @test eltype(A \ b) == eltype(A \ B) == eltype(B / A) == Int |
| 183 | + end |
| 184 | +end |
| 185 | + |
150 | 186 | @testset "multiplication of special sparse with dense matrix" begin |
151 | 187 | # this results in a call of the most generic multiplication code in LinearAlgebra.jl |
152 | 188 | A = randn(2, 2) |
@@ -228,6 +264,7 @@ begin |
228 | 264 | AW = tr(wr(A)) |
229 | 265 | MAW = tr(wr(MA)) |
230 | 266 | @test AW \ B ≈ MAW \ B |
| 267 | + @test !issparse(AW \ B) |
231 | 268 | # and for SparseMatrixCSCView - a view of all rows and unit range of cols |
232 | 269 | vAW = tr(wr(view([zero(A)+I A], :, (n+1):2n))) |
233 | 270 | @test vAW \ B ≈ AW \ B |
|
0 commit comments