General Purpose Matrix Operations



General Purpose Routines

Operations such as copying a matrix, extracting a row or column, replacing a row or column, extracting the diagonal, replacing the diagonal, interchanging two rows, interchanging two columns, forming a new matrix by joining two matrices along rows or columns, setting each component of a matrix to a constant, extracting a submatrix, replacing a submatrix and transposing a matrix depend only on the property that an object is a matrix and does not depend on the nature of the matrix elements themselves.

The functionality of matrix routines in this collection are routines with this property but the implementation is for real matrices declared as double A[M][N] or for dynamically defined matrices declared as double* A and for complex matrices declared as double complex A[M][N] or for dynamically defined matrices declared as double complex *A.

A vector is a simply an array which can be regarded as a 1×n matrix or an n×1 matrix. The term is borrowed from linear algebra where linear transformations operate on vectors, after choosing a basis for the domain and range, the linear transformations can be represented as matrices and the vectors as an n×1 matrix. Real Vectors are declared as double v[] or dynamically defined vectors are declared as double* v and complex vectors are declared as double complex v[] or dynamically defined vectors are declared as double complex *v.

Table of General Purpose Matrix Operations