@@ -109,14 +109,13 @@ CSR_Matrix *ATA_alloc(const CSC_Matrix *A, size_t *mem)
109109 }
110110
111111 /* Allocate C and symmetrize it */
112- CSR_Matrix * C = new_csr_matrix (n , n , nnz , NULL );
112+ CSR_Matrix * C = new_csr_matrix (n , n , nnz , mem );
113113 symmetrize_csr (Cp , Ci -> data , n , C );
114114
115115 /* free workspace */
116116 free (Cp );
117117 iVec_free (Ci );
118118
119- if (mem ) * mem += csr_memory_bytes (C );
120119 return C ;
121120}
122121
@@ -213,7 +212,7 @@ void ATDA_fill_values(const CSC_Matrix *A, const double *d, CSR_Matrix *C)
213212
214213CSC_Matrix * csr_to_csc_alloc (const CSR_Matrix * A , int * iwork , size_t * mem )
215214{
216- CSC_Matrix * C = new_csc_matrix (A -> m , A -> n , A -> nnz , NULL );
215+ CSC_Matrix * C = new_csc_matrix (A -> m , A -> n , A -> nnz , mem );
217216
218217 int i , j ;
219218 int * count = iwork ;
@@ -252,7 +251,6 @@ CSC_Matrix *csr_to_csc_alloc(const CSR_Matrix *A, int *iwork, size_t *mem)
252251 }
253252 }
254253
255- if (mem ) * mem += csc_memory_bytes (C );
256254 return C ;
257255}
258256
@@ -277,7 +275,7 @@ void csr_to_csc_fill_values(const CSR_Matrix *A, CSC_Matrix *C, int *iwork)
277275
278276CSR_Matrix * csc_to_csr_alloc (const CSC_Matrix * A , int * iwork , size_t * mem )
279277{
280- CSR_Matrix * C = new_csr_matrix (A -> m , A -> n , A -> nnz , NULL );
278+ CSR_Matrix * C = new_csr_matrix (A -> m , A -> n , A -> nnz , mem );
281279
282280 int i , j ;
283281 int * count = iwork ;
@@ -318,7 +316,6 @@ CSR_Matrix *csc_to_csr_alloc(const CSC_Matrix *A, int *iwork, size_t *mem)
318316 }
319317 }
320318
321- if (mem ) * mem += csr_memory_bytes (C );
322319 return C ;
323320}
324321
@@ -388,15 +385,14 @@ CSR_Matrix *BTA_alloc(const CSC_Matrix *A, const CSC_Matrix *B, size_t *mem)
388385 }
389386
390387 /* Allocate C */
391- CSR_Matrix * C = new_csr_matrix (p , n , nnz , NULL );
388+ CSR_Matrix * C = new_csr_matrix (p , n , nnz , mem );
392389 memcpy (C -> p , Cp , (p + 1 ) * sizeof (int ));
393390 memcpy (C -> i , Ci -> data , nnz * sizeof (int ));
394391
395392 /* free workspace */
396393 free (Cp );
397394 iVec_free (Ci );
398395
399- if (mem ) * mem += csr_memory_bytes (C );
400396 return C ;
401397}
402398
@@ -536,15 +532,14 @@ CSC_Matrix *symBA_alloc(const CSR_Matrix *B, const CSC_Matrix *A, size_t *mem)
536532
537533 /* allocate C and copy the computed structure */
538534 int total_nnz = Cp [n ];
539- CSC_Matrix * C = new_csc_matrix (m , n , total_nnz , NULL );
535+ CSC_Matrix * C = new_csc_matrix (m , n , total_nnz , mem );
540536 memcpy (C -> p , Cp , (n + 1 ) * sizeof (int ));
541537 memcpy (C -> i , Ci -> data , total_nnz * sizeof (int ));
542538
543539 free (marker );
544540 free (Cp );
545541 iVec_free (Ci );
546542
547- if (mem ) * mem += csc_memory_bytes (C );
548543 return C ;
549544}
550545
0 commit comments