PsiLAB Help Manual Page

Section: High level matrix functions

Name: read_cmat

Read a complex matrix in fortran format from a file.
This function reads a complex vector or matrix (2 dim) from a file in fortran format. Either the target matrix is allocated automatically with sizes determined by the file header (first line), or an already allocated matrix can be provided with the mat argument. The header in the file is necessary in the first case, optional in the second case.
[ ?mat:(Complex.t, 'a, 'b) Matrix.t ] =
read_cmat
file:string
?mat:(Complex.t, 'a, 'b) Matrix.t list
?header:bool
()

The header can be discarded if the header argument is set to false.
Example:
[] let c = cmatrix ~dim:[5;3] ~rand:[1.0] () ;; 
[] write_cmat "test.dat" c () ;; 
[] let cr = read_cmat "test.dat" () ;; 

Printed by PsiLAB