1# The convention used here for storing matrices is the same commonly 2# used for scientific programming in C, namely linearizing in Fortran order. 3# Let A be an m by n matrix. We represent this by 4# a: array of real; 5# m, n, lda: int; 6# where the variable lda ("leading dimension of a") is used so that a 7# succession of matrix problems of varying sizes can be created without 8# wholesale copying of data. The element of A in the i-th row and j-th column 9# is stored in a[i+lda*j], where 0<=i<m and 0<=j<n. This 0-origin indexing 10# is used everywhere, and in particular in permutation vectors. 11 12LinAlg: module{ 13 PATH: con "/dis/math/linalg.dis"; 14 15 Vector: type array of real; 16 Matrix: adt{ 17 m, L, n: int; # rows, column stride, columns 18 a: Vector; # data, stored A[i,j] = a[i+L*j] 19 }; 20 21 dgefa: fn(a:array of real, lda, n:int, ipvt:array of int): int; 22 dgesl: fn(a:array of real, lda, n:int, ipvt:array of int, b:array of real, job:int); 23 printmat: fn(label:string, a:array of real, lda, m, n:int); 24}; 25