PsiLAB Help Manual Page

Section: High level matrix functions

Name: write_fmat

Write a float matrix in fortran format to a file.
This function writes a float vector or matrix (2 dim) to a file in fortran format. The first line of the file contains the matrix description.
write_fmat
file:string
mat:(float, 'a, 'b) Matrix.t
?header:bool
()

The header can be avoided if the header argument is set to false.
Format of the header line:
float < matrix dimension > < number of rows > < number of columns >

In the case of a vector, the last value is zero (!) and the matrix dimension one.
Example:
[] let f = fmatrix ~dim:[5;3] ~rand:[1.0] () ;; 
[] write_fmat "test.dat" f () ;; 
[] let fr = read_fmat "test.dat" () ;; 

Printed by PsiLAB