-
To make a new matrix given its array of real just create the record.
set m to {class:matrix, ncols:200, nrows:150, array of real:a}
-
Alternately, use the handler ArrayToMatrix (also defined as MatrixFromArray) that Smile defines as a shortcut for that.
set m to ArrayToMatrix(the_array, n_cols, n_rows)
-- is equiavalent to:
set m to {class:matrix, ncols:n_cols, nrows:n_rows, array of real:the_array}
ArrayToMatrix accepts as the_array, either an array of real, or a list of arrays of real, in which case it will return a list of matrices.
-
It is your responsibility that the array of real's size be equal to ncols * nrows.
|