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.
mat:(float, 'a, 'b) Matrix.t

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.
[] let f = fmatrix ~dim:[5;3] ~rand:[1.0] () ;; 
[] write_fmat "test.dat" f () ;; 
[] let fr = read_fmat "test.dat" () ;; 

Printed by PsiLAB