- HasNan
- ReplaceNan
- ReplaceToZero
- NormalizeDouble
- Transpose
- TransposeConjugate
- TriL
- TriU
- Diag
- Row
- Col
- Copy
- Swap
- Conjugate
- Concat
- Compare
- CompareByDigits
- CompareEqual
- Flat
- Clip
- Reshape
- Resize
- Free
- Set
- SwapRows
- SwapCols
- Split
- Hsplit
- Vsplit
- ArgSort
- Sort
Resize
Changes the size of a matrix or vector.
bool matrix::Resize(
|
Parameters
rows
[in] New number or rows.
cols
[in] New number or columns.
Return Value
Returns true on success, false otherwise.
Note
The matrix (or vector) is processed in place. No copies are created. Any size can be specified, i.e., rows_new*cols_new!=rows_old*cols_old. Unlike Reshape, the matrix is processed row by row. When increasing the number of columns, the values of the extra columns are undefined. When increasing the number of rows, the values of elements in the new rows are undefined. When the number of columns is reduced, each row of the matrix is truncated.
When the size of the matrix (or vector) is reduced, the size of the buffer for storing the matrix or vector data does not change. If you need to change the size of the matrix (or vector) to zero and free the buffer, use the Free method.
Example
matrix matrix_a={{1,2,3},{4,5,6},{7,8,9},{10,11,12}};
|