PsiLAB Help Manual
Page
Section:
Basic Matrix functions
Name:
cmatrix_byname
Allocates a new complex 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.
cmatrix_byname
?dim:int list
?create:string list
?destroy:string list
()
The dimension list argument dim determines the matrix sizes. The create list argument is used for 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 "; ... ]
Note 1.)
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!!!!
Example:
(* allocate a new matrix named "mymatrix" *)
[] cmatrix_byname ~dim:[100;100] ~create:["mymatrix"] ();;
[] let iv () =
(* cmat gets the matrix *)
let cmat = cmatrix_get_byname "mymatrix" () in
...
(* if the matrix is no longer used: *)
[] cmatrix_byname ~destroy:["mymatrix"] () ;;
Printed by PsiLAB