Skip to content

Commit 0cbd45d

Browse files
committed
Last commit for tonight...
1 parent 88da682 commit 0cbd45d

File tree

1 file changed

+29
-34
lines changed

1 file changed

+29
-34
lines changed

src/decompression.jl

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -718,35 +718,31 @@ end
718718

719719
## StarSetBicoloringResult
720720

721-
# function decompress!(
722-
# A::AbstractMatrix,
723-
# Br::AbstractMatrix,
724-
# Bc::AbstractMatrix,
725-
# result::StarSetBicoloringResult,
726-
# )
727-
# (; S, A_indices, compressed_indices, pos_Bc) = result
728-
# fill!(A, zero(eltype(A)))
729-
730-
# ind_Br = 0
731-
# ind_Bc = pos_Br
732-
# counter = 0
733-
# rvS = rowvals(S)
734-
# for j in axes(S, 2)
735-
# for k in nzrange(S, j)
736-
# i = rvS[k]
737-
# counter += 1
738-
# ...
739-
# if in_triangle(i, j, :L)
740-
# ind_Br += 1
741-
# A[i - n, j] = Br[compressed_indices[ind_Br]]
742-
# else
743-
# ind_Bc += 1
744-
# A[j - n, i] = Bc[compressed_indices[ind_Bc]]
745-
# end
746-
# end
747-
# end
748-
# return A
749-
# end
721+
function decompress!(
722+
A::AbstractMatrix,
723+
Br::AbstractMatrix,
724+
Bc::AbstractMatrix,
725+
result::StarSetBicoloringResult,
726+
)
727+
(; S, A_indices, compressed_indices, pos_Bc) = result
728+
fill!(A, zero(eltype(A)))
729+
730+
ind_Bc = 1
731+
rvS = rowvals(S)
732+
for j in axes(S, 2)
733+
for k in nzrange(S, j)
734+
i = rvS[k]
735+
index = compressed_indices[k]
736+
if A_indices[ind_Bc] == k && ind_Bc <= pos_Bc
737+
A[i, j] = Bc[index]
738+
ind_Bc += 1
739+
else
740+
A[i, j] = Br[index]
741+
end
742+
end
743+
end
744+
return A
745+
end
750746

751747
function decompress!(
752748
A::SparseMatrixCSC,
@@ -810,13 +806,13 @@ function decompress!(
810806
(i, j) = reverse_bfs_orders[pos]
811807
cj = symmetric_color[j]
812808
if in_triangle(i, j, :L)
813-
val = Bc[i - n, symmetric_to_column[cj]] - buffer_right_type[i]
809+
val = Bc[i, symmetric_to_column[cj]] - buffer_right_type[i]
814810
buffer_right_type[j] = buffer_right_type[j] + val
815-
A[i - n, j] = val
811+
A[i, j] = val
816812
else
817813
val = Br[symmetric_to_row[cj], i] - buffer_right_type[i]
818814
buffer_right_type[j] = buffer_right_type[j] + val
819-
A[j - n, i] = val
815+
A[j, i] = val
820816
end
821817
end
822818
end
@@ -841,7 +837,6 @@ function decompress!(
841837
) = result
842838

843839
m, n = size(A)
844-
A_colptr = A.colptr
845840
nzA = nonzeros(A)
846841

847842
if eltype(buffer) == R
@@ -876,7 +871,7 @@ function decompress!(
876871
#! format: off
877872
# A[i,j] is in the lower triangular part of A
878873
if in_triangle(i, j, :L)
879-
val = Bc[i - n, symmetric_to_column[cj]] - buffer_right_type[i]
874+
val = Bc[i, symmetric_to_column[cj]] - buffer_right_type[i]
880875
buffer_right_type[j] = buffer_right_type[j] + val
881876

882877
# A[i,j] is stored at index_ij = A_indices[counter] in A.nzval

0 commit comments

Comments
 (0)