Mark Bishop

Analytical Chemistry and

Signal Acquisition/Analysis

Matrix Computations

This section presents Java implementations of matrix computation algorithms and improves code included in an original document that presented the material together with implementations in C#.Net: Implementing Matrix Computation Algorithms, (2007), Mark Bishop, New England Testing Laboratory, Providence, RI.

Implementing Matrix Computation was developed with the following primary reference: Matrix Computations 3rd Edition by Gene H. Golub and Charles F. Van Loan (Johns Hopkins University Press, Baltimore, 1996).

The CPU implementations manage matrices as row-major float[m][n] arrays, where m = row count and n = column count. Vectors are represented as float[n] arrays. To be compatible with NVidia Cuda, the GPU implementations use column-major, vector representations of matrices, but convenience methods are provided in the classes for passing row-major float[][] objects to the GPU methods. The implementations are literal translations of pseudo code and are not production-optimized.

In certain cases the methods return result objects that contain multiple result components arranged in object lists or arrays of float[][].

These include:

List<object>; GaussUpperTriangularFullPivot(float[ ][ ] A)
float[ ][ ][ ] ParseLU(float[ ][ ] LU)
List<object>; HouseholderCompactQRPivot(float[ ][ ] A)
float[ ][ ][ ] LU(float A[ ][ ])

For example, the HouseholderCompactQRPivot (float[ ][ ] A) method returns a list<object> that includes an integer (that holds the matrix rank), an integer array (that holds a permutation matrix in vector form), and a float array (that holds pre-calculated beta factors such that Beta[j] = 2/(v[j]Transpose *v[j]) and Beta[length-1] = 0). This method also overwrites the A matrix with a compact form QR factorization.

Disclaimer and License

While this website is believed to contain correct information, neither the author nor sponsors, nor any of their employees, makes any warranty, express or implied, or assumes any legal responsibility for the accuracy, completeness, safety, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights.

All software is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Software is provided in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details:

ID may be exposed