diff --git a/base/sparse/cholmod.jl b/base/sparse/cholmod.jl index e729853278c2c..d993419b9a93b 100644 --- a/base/sparse/cholmod.jl +++ b/base/sparse/cholmod.jl @@ -1465,7 +1465,7 @@ Ac_ldiv_B(L::FactorComponent, B) = ctranspose(L)\B (\){T}(L::Factor{T}, B::Dense{T}) = solve(CHOLMOD_A, L, B) (\)(L::Factor{Float64}, B::VecOrMat{Complex{Float64}}) = L\real(B) + L\imag(B) (\)(L::Factor, b::StridedVector) = Vector(L\convert(Dense{eltype(L)}, b)) -(\)(L::Factor, B::Matrix) = Matrix(L\convert(Dense{eltype(L)}, B)) +(\)(L::Factor, B::StridedMatrix) = Matrix(L\convert(Dense{eltype(L)}, B)) (\)(L::Factor, B::Sparse) = spsolve(CHOLMOD_A, L, B) # When right hand side is sparse, we have to ensure that the rhs is not marked as symmetric. (\)(L::Factor, B::SparseVecOrMat) = sparse(spsolve(CHOLMOD_A, L, Sparse(B, 0))) diff --git a/test/sparsedir/cholmod.jl b/test/sparsedir/cholmod.jl index bc21d912b7591..40b7724b664d9 100644 --- a/test/sparsedir/cholmod.jl +++ b/test/sparsedir/cholmod.jl @@ -632,3 +632,10 @@ Fnew = deserialize(b) @test_throws MethodError cholfact(speye(BigFloat, 5)) @test_throws MethodError cholfact(Symmetric(speye(BigFloat, 5))) @test_throws MethodError cholfact(Hermitian(speye(Complex{BigFloat}, 5))) + +# test \ for Factor and StridedVecOrMat +let x = rand(5) + A = cholfact(sparse(diagm(x.\1))) + @test_approx_eq A\sub(ones(10),1:2:10) x + @test_approx_eq A\slice(eye(5,5),:,:) diagm(x) +end