Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ compress
decompress
decompress!
decompress_single_color!
decompress_csc!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specific result types we use are not public right now, so this function cannot be public either

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was failing if not included in the docs since it has a docstring.
What do you mean by result types not being public ? decompress! also takes result as argument

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that the precise names and fields of the results which are returned are subject to change.
That's also why I asked whether we wanted to extend decompress_csc! beyond just the acyclic coloring case, because otherwise we have to document that it only works for a specific type of coloring. In any case, I'd rather keep it in the private part of the package and list the docstring among the internals, so that you can start using it but we're free to refine the interface in future versions.

```

## Orders
Expand Down
34 changes: 28 additions & 6 deletions src/decompression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,23 @@ function decompress!(
return A
end

function decompress!(
A::SparseMatrixCSC{R},
"""
function decompress_csc!(
nzA::AbstractVector{R},
A_colptr::AbstractVector,
B::AbstractMatrix{R},
result::TreeSetColoringResult,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a bit weird to only add this for the acyclic case, you don't need it for anything else on the JuMP side?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I haven't tested with star coloring yet. That's one of the advantage of using SMC, now we can easily test with star coloring as well :)

uplo::Symbol=:F,
) where {R<:Real}

Decompress the values of `B` into the vector of nonzero entries `nzA` of a
sparse matrix with column pointers `colptr`. This function assumes that the
row indices are sorted in increasing order and are the same as those of the
sparse matrix given to the `coloring` function that returned `result`.
"""
function decompress_csc!(
nzA::AbstractVector{R},
A_colptr::AbstractVector{<:Integer},
B::AbstractMatrix{R},
result::TreeSetColoringResult,
uplo::Symbol=:F,
Expand All @@ -603,10 +618,6 @@ function decompress!(
upper_triangle_offsets,
buffer,
) = result
(; S) = ag
A_colptr = A.colptr
nzA = nonzeros(A)
check_compatible_pattern(A, ag, uplo)

if eltype(buffer) == R
buffer_right_type = buffer
Expand Down Expand Up @@ -696,6 +707,17 @@ function decompress!(
#! format: on
end
end
return nothing
end

function decompress!(
A::SparseMatrixCSC{R},
B::AbstractMatrix{R},
result::TreeSetColoringResult,
uplo::Symbol=:F,
) where {R<:Real}
check_compatible_pattern(A, result.ag, uplo)
decompress_csc!(nonzeros(A), A.colptr, B, result, uplo)
return A
end

Expand Down
Loading