Skip to content

Commit

Permalink
Define _to_linear_index so that displaying and isassigned works properly
Browse files Browse the repository at this point in the history
  • Loading branch information
projekter committed Dec 25, 2024
1 parent bdc417a commit 87e32b2
Show file tree
Hide file tree
Showing 2 changed files with 9 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 = "StandardPacked"
uuid = "65f29c17-9e56-4606-972f-81e04007695c"
authors = ["Benjamin Desef <[email protected]>"]
version = "1.0.3"
version = "1.0.4"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
8 changes: 8 additions & 0 deletions src/spmatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ packed_unscale!(P::SPMatrixScaled{R}) where {R} =
rmul_offdiags!(SPMatrix(P.dim, P.data, packed_isupper(P) ? :U : :L), sqrt(inv(R(2))))
packed_unscale!(P::SPMatrixUnscaled) = P

@inline function Base._to_linear_index(P::SPMatrix{<:Any,<:Any,Fmt}, row::Integer, col::Integer) where {Fmt}
if (Fmt === :U || Fmt === :US ? Base.: : Base.:)(row, col)
return @inbounds rowcol_to_vec(P, row, col)
else
return @inbounds rowcol_to_vec(P, col, row)
end
end

"""
P[idx]
Expand Down

0 comments on commit 87e32b2

Please sign in to comment.