PsiLAB Help Manual
Basic Matrix functions
Allocates a new integer matrix indentified by a unique name string.
This function allocates a new matrix. At this point, the matrix is not visible to Psilab, but only internally allocated. A further function call with imatrix_get_byname connect the internal data space with a Psilab (Caml) variable name. The name string is used for identification.
The dimension argument dim determines the matrix sizes. The create list argument is used for the creation of one or more named matrices, all sharing the same data space, and the destroy list argument is used for destroying (freeing) of the data space owned by the named matrices.
~dim:[ dim 1 ; sim 2 ; ... ]
~create:[ "name 1 ";"name 2 "; ... ]
~destroy:[ "name 1 ";"name 2 "; ... ]
After freeing the data, it's still possible to do all matrix operations on this matrix, but with disastrous results. The user is responsible to make sure no one uses this matrix beyond the destroy operation!!!!
(* allocate a new matrix named "mymatrix" *)
 imatrix_byname ~dim:[100;100] ~create:["mymatrix"] ();;
 let iv () =
(* imat gets the matrix *)
let imat = imatrix_get_byname "mymatrix" () in
(* if the matrix is no longer used: *)
 imatrix_byname ~destroy:["mymatrix"] () ;;
Printed by PsiLAB