|
4.6.1 intmat declarations
- Syntax:
intmat name = intmat_expression ;
intmat name [ rows ] [ cols ] = intmat_expression ;
intmat name [ rows ] [ cols ] = list_of_int_and_intvec_and_intmat_expressions ;
rows and cols must be positive int expressions.
- Purpose:
- defines an intmat variable.
Given a list of integers, the matrix is filled up with the first row
from the left to the right, then the second row and so on.
If the int_list contains less than rows*cols elements,
the matrix is filled up with zeros; if it contains more
elements, only the first rows*cols elements are used.
- Default:
- 0 (1 x 1 matrix)
- Example:
| intmat im[3][5]=1,3,5,7,8,9,10,11,12,13;
im;
==> 1,3,5,7,8,
==> 9,10,11,12,13,
==> 0,0,0,0,0
im[3,2];
==> 0
intmat m[2][3] = im[1..2,3..5]; // defines a submatrix
m;
==> 5,7,8,
==> 11,12,13
|
|