PsiLAB Help Manual
Page
Section:
Basic Matrix functions
Name:
fmatrix_byname
Allocates a new float 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 fmatrix_get_byname connect the internal data space with a Psilab (Caml) variable name. The name string is used for identification.
fmatrix_byname
?dim:int list
?create:string list
?destroy:string list
()
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 "; ... ]
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" *)
[] fmatrix_byname ~dim:[100;100] ~create:["mymatrix"] ();;
[] let iv () =
(* fmat gets the matrix *)
let fmat = fmatrix_get_byname "mymatrix" () in
...
(* if the matrix is no longer used: *)
[] fmatrix_byname ~destroy:["mymatrix"] () ;;
Printed by PsiLAB