Home · Pages · Index · Overviews

Linear Algebra Module Reference

Matrix arithmetic including inversion. More...

 #include <linear.algebra.h>

Routines

Double_Matrix * Identity_MatrixG (Dimn_Type n)
Double_Matrix * Set_Matrix2Identity (Double_Matrix *m RM)

Double_Matrix * Transpose_Matrix (Double_Matrix *m RM)

Double_Matrix * Matrix_MultiplyG (Double_Matrix *a, boolean ta, Double_Matrix *b, boolean tb)
Double_Matrix * Set_Matrix2Product (Double_Matrix *c RM,
                                    Double_Matrix *a, boolean ta, Double_Matrix *b, boolean tb)

Double_Matrix * Orthogonalize_Matrix (Double_Matrix *m RM)

Detailed Description

The linear algebra module consists of this page and two classes: LU_Factor and Band_Factor that realize matrix inversion via factored forms, where the former is for general matrices and the latter is for tri- and penta-diagonal systems. A planned addition for the module is to support eigen-values and eigen-vectors.

Currently the module has some simple routines to generate or set up an identity matrix (Identity_Matrix and Set_Matrix2Identity), a simple, in-place matrix transpose routine (Transpose_Matrix), and routines to generate or set up the product of two matrices and/or their transposes (Matrix_Multiply and Set_Matrix2Product). Finally, one can get an orthogonal rotation matrix that spans the same basis as a given subject array via a stable Gram-Schmidt process by calling Orthogonalize_Matrix.


Routine Documentation

Double_Matrix * Identity_MatrixG (Dimn_Type n)

Generates a square n x n identity matrix.

Double_Matrix * Set_Matrix2Identity (Double_Matrix *m RM)

Sets the square matrix m to the identity matrix of its size and as a convenience return a pointer to it.

Double_Matrix * Transpose_Matrix (Double_Matrix *m RM)

Transposes the matrix m (not necessarily square) in place and as a convenience return a pointer to it.

Double_Matrix * Matrix_MultiplyG (Double_Matrix *a, boolean ta, Double_Matrix *b, boolean tb)

Generates the product of a and b. If ta is true than use a' in lieu of a, and similarly if tb is true than use b'.

Double_Matrix * Set_Matrix2Product (Double_Matrix *c RM,
                                    Double_Matrix *a, boolean ta, Double_Matrix *b, boolean tb)

Sets the matrix c to the product of a and b or their transposes as indicated by the boolean flags ta and tb. The matrix c must already be of the correct shape to hold the product.

Double_Matrix * Orthogonalize_Matrix (Double_Matrix *m RM)

Replace the square matrix m with an orthogonal rotation matrix that covers the same basis as m, and return a pointer to it as a convenience. The routine uses a "stable" version of Gram-Schmidt, which is not as stable as methods that use SVD (for which we do not have an implementation), so be cautious about the stability of the output matrix.