[numerics] fix bug in eye()
@@ -409,17 +409,16 @@ NumericsSparseMatrix * NSM_triplet_eye(unsigned int size)
CSparseMatrix * C = cs_spalloc(size, size, size, 1, 1);
- for (unsigned int k ; k < size; k++)
+ for (unsigned int k=0 ; k < size; k++)
{
+ C->nz++;
C->i[k] =k;
C->p[k] =k;
C->x[k] =1.0;
}
- if (C->nz >= 0)
- {
assert(out->origin ==NSM_TRIPLET);
out->triplet = C;
out->origin = NSM_TRIPLET;
- }
return out;
}
+
