Skip to content

Commit 361d557

Browse files
authored
fix linear solve with views (#707)
Closes #706 We don't want to preserve the stride here because it will be copied onto a plain `Array`.
1 parent 99a103b commit 361d557

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/solvers/cholmod.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ get_perm(FC::FactorComponent) = get_perm(Factor(FC))
819819
# Conversion/construction
820820

821821
function Dense{T}(A::StridedVecOrMatInclAdjAndTrans) where T<:VTypes
822-
d = allocate_dense(size(A, 1), size(A, 2), A isa StridedVecOrMat ? stride(A, 2) : size(A, 1), T)
822+
d = allocate_dense(size(A, 1), size(A, 2), size(A, 1), T)
823823
D = unsafe_wrap(Array, Ptr{eltype(d)}(unsafe_load(pointer(d)).x), size(A), own = false)
824824
copyto!(D, A)
825825
return d

test/cholmod.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ end
794794
A = cholesky(sparse(Diagonal(x.\1)))
795795
@test A\view(fill(1.,10),1:2:10) x
796796
@test A\view(Matrix(1.0I, 5, 5), :, :) Matrix(Diagonal(x))
797+
@test A\view(Matrix(1.0I, 6, 5), 1:5, :) Matrix(Diagonal(x))
797798
end
798799

799800
@testset "Test \\ for Factor and SparseVecOrMat" begin

0 commit comments

Comments
 (0)