Bytecode / sparse transpose: bug fix

The Jc vector has n+1 elements, where n is the number of columns. Moreover, the
size passed to memset() was wrong.
time-shift
Sébastien Villemot 2021-02-09 16:01:01 +01:00
parent c9f6d3a626
commit 1a0ee5f055
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 1 additions and 1 deletions

View File

@ -1929,7 +1929,7 @@ dynSparseMatrix::Sparse_transpose(const mxArray *A_m)
mwIndex *C_j = mxGetJc(C_m);
double *C_d = mxGetPr(C_m);
unsigned int nze_C = 0, nze_A = 0;
memset(C_j, 0, m_A);
fill_n(C_j, m_A+1, 0);
map<pair<mwIndex, unsigned int>, double> B2;
for (unsigned int i = 0; i < n_A; i++)
while (nze_A < static_cast<unsigned int>(A_j[i+1]))