@@ -718,35 +718,31 @@ end
718
718
719
719
# # StarSetBicoloringResult
720
720
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
750
746
751
747
function decompress! (
752
748
A:: SparseMatrixCSC ,
@@ -810,13 +806,13 @@ function decompress!(
810
806
(i, j) = reverse_bfs_orders[pos]
811
807
cj = symmetric_color[j]
812
808
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]
814
810
buffer_right_type[j] = buffer_right_type[j] + val
815
- A[i - n , j] = val
811
+ A[i, j] = val
816
812
else
817
813
val = Br[symmetric_to_row[cj], i] - buffer_right_type[i]
818
814
buffer_right_type[j] = buffer_right_type[j] + val
819
- A[j - n , i] = val
815
+ A[j, i] = val
820
816
end
821
817
end
822
818
end
@@ -841,7 +837,6 @@ function decompress!(
841
837
) = result
842
838
843
839
m, n = size (A)
844
- A_colptr = A. colptr
845
840
nzA = nonzeros (A)
846
841
847
842
if eltype (buffer) == R
@@ -876,7 +871,7 @@ function decompress!(
876
871
# ! format: off
877
872
# A[i,j] is in the lower triangular part of A
878
873
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]
880
875
buffer_right_type[j] = buffer_right_type[j] + val
881
876
882
877
# A[i,j] is stored at index_ij = A_indices[counter] in A.nzval
0 commit comments