PsiLAB Help Manual Page

Section: High level matrix functions

Name: write_imat

Write an integer matrix in fortran format to a file.
This function writes an integer vector or matrix (2 dim) to a file in fortran format. The first line of the file contains the matrix description.
mat:(int, 'a, 'b) Matrix.t

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

In the case of a vector, the last value is zero (!), and the dimension 1.
[] let i = imatrix ~dim:[5;3] ~rand:[100] () ;; 
[] write_imat "test.dat" i () ;; 
[] let ir = read_imat "test.dat" () ;; 

Printed by PsiLAB