Skip to content

Commit

Permalink
fix 1.3+ compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger-luo committed Sep 20, 2019
1 parent 42bf27c commit ce856f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LuxurySparse"
uuid = "d05aeea4-b7d4-55ac-b691-9e7fabb07ba2"
authors = ["GiggleLiu <cacate0129@gmail.com>", "Roger-luo <hiroger@qq.com>"]
version = "0.4.2"
version = "0.4.3"

[deps]
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
Expand Down
4 changes: 4 additions & 0 deletions src/conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ function SparseMatrixCSC(M::PermMatrix)
SparseMatrixCSC(n, n, collect(1:n+1), order, M.vals[order])
end

if VERSION > v"1.2"

function SparseMatrixCSC(D::Diagonal{T}) where T
m = length(D.diag)
return SparseMatrixCSC(m, m, Vector(1:(m+1)), Vector(1:m), Vector{T}(D.diag))
end

end

SparseMatrixCSC{Tv, Ti}(M::PermMatrix{Tv, Ti}) where {Tv, Ti} = SparseMatrixCSC(M)
SparseMatrixCSC(coo::SparseMatrixCOO) = sparse(coo.is, coo.js, coo.vs, coo.m, coo.n)

Expand Down

0 comments on commit ce856f1

Please sign in to comment.