TMtxVec Resize(Int32 Len, Boolean ZeroIt)
Resizes the sparse matrix to a new number of non-zeros.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Len | Int32 | element count |
| 2 | ZeroIt | Boolean |
Result: stored in self (calling object), returns self for chaining
Remarks:
Resizes the sparse matrix to a new number of non-zeros. The existing values are preserved up to the new size. This includes the sparsity pattern arrays Ai and Ap. This resize does not change the number of Columns of the sparse matrix, but only the number of non-zeros that can be stored in the matrix.
Examples
Tvec a;
MtxVec.CreateIt(out a);
try
{
a.SetIt(false,new double[] {1,2,3});
a.Resize(7,true); // a= new double[] {1,2,3,0,0,0,0}
}
finally
{
MtxVec.FreeIt(ref a);
}