TABLE I - Summary of User Functions in Matrix.library 1. AllocLVector / AllocDVector (numels) Allocates memory for a vector containing numels elements and returns a pointer to the memory space. 2. AllocLMatrix / AllocDMatrix (numrows,numcols) Allocates memory for a matrix with numrows rows and numcols columns and returns a pointer to a vector of row pointers. 3. FreeLVector / FreeDVector (v,numels) Frees the memory allocated by AllocLVector or AllocDVector where v is the pointer returned by these functions and numels is the number of elements in the vector. Returns either TRUE or FALSE. 4. FreeLMatrix / FreeDMatrix (m,numrows,numcols) Frees the memory allocated by AllocLMatrix of AllocDMatrix where m is the pointer returned by these functions, numrows is the number of rows in the matrix, and numcols is the number of columns in the vector. Returns either TRUE or FALSE. 5. AddLVectors / AddDVectors (v1,v2,vr,numels) Adds the numels elements of vectors v1 and v2 and puts the results in vector vr. If vr is NULL, it is allocated. Returns vr. 6. SubLVectors / SubDVectors (v1,v2,vr,numels) Subtracts the numels elements of vector v2 from v1 and puts the results in vector vr. If vr is NULL, it is allocated. Returns vr. 7. AddLMatrices / AddDVectors (m1,m2,mr,numrows,numcols) Adds the numrows*numcols elements of matrices m1 and m2 and puts the results in matrix mr. If mr is NULL, it is allocated. Returns mr. 8. SubLMatrices / SubDMatrices (m1,m2,mr,numrows,numcols) Subtracts the numrows*numcols elements of matrix m2 from m1 and puts the results in matrix mr. If mr is NULL, it is allocated. Returns mr. 9. MultLMatrices / MultDMatrices (m1,m2,mr,numrows1,numcols1,numcols2) Multiplies matrix m1 with numrows1 rows and numcols1 columns and matrix m2 with numcols1 rows and numcols2 columns (e.g.-m1*m2). The result is placed in matrix mr with numrows1 rows and numcols2 columns. If mr is NULL, it is allocated. Returns mr. 10. MultLVectorMatrix / MultDVectorMatrix (v,m,vr,numels,numcols) Multiplies vector v with numels elements and matrix m with numels rows and numcols columns (e.g.- v*m). The result is placed in vector vr with numcols elements. The order of multiplication implies that v and vr are both row vectors. If vr is NULL, it is allocated. Returns vr. 11. MultLMatrixVector / MultDMatrixVector (m,v,vr,numrows,numels) Multiplies matrix m with numrows rows and numels columns and vector v with numels elements (e.g.- m*v). The result is placed in vector vr with numrows elements. The order of multiplication implies that v and vr are both column vectors. If vr is NULL, it is allocated. Returns vr. 12. TransposeLMatrix / TransposeDMatrix (m,mt,numrows,numcols) Transposes matrix m with numrows rows and numcols columns. The result is placed in mt with numcols rows and numrows columns. If mt is NULL, it is allocated. Returns mt. 13. InvertDMatrix (m,mcopy,mi,numrows) Inverts a square matrix m with numrows rows and columns and puts the result in matrix mi with numrows rows and columns. mcopy is a duplicate of m. If it is passed to the function as NULL, InvertDMatrix will allocate it, copy m to it, use it for the inverse calculations (it is destroyed in the process), and then deallocate it. Also, if mi is passed to the function as NULL, InvertDMatrix will allocate it. This function is not implemented for long integers because it is highly unlikely that a long integer matrix will have an inverse that is composed of all integers.