have values.
If a matrix is constructed using _from_coordinate_arrays, it calls
from_coordinate_arrays_internal with SUM_REPEATED_ALL. The latter function then
calls sum_repeated_entries. This causes values to be added to the array
Later, if the matrix is passed to make_undirected, this calls symmetrize,
which may call _copy. If _copy uses _new, the new array will use the input
array's type (pattern) and not create memory values, causing the memcpy to fail.
SparseMatrix SparseMatrix_copy(SparseMatrix A){
SparseMatrix B;
if (!A) return A;
- B = SparseMatrix_new(A->m, A->n, A->nz, A->type, A->format);
+ B = SparseMatrix_general_new(A->m, A->n, A->nz, A->type, A->size, A->format);
MEMCPY(B->ia, A->ia, sizeof(int)*((size_t)(A->m+1)));
MEMCPY(B->ja, A->ja, sizeof(int)*((size_t)(A->ia[A->m])));
if (A->a) MEMCPY(B->a, A->a, A->size*((size_t)A->nz));