This package contains unofficial Java versions of many of the
BLAS (Basic Linear Algebra Subroutines), and the
LINPACK
Cholesky decomposition (dpofa, dposl, and dpodi), QR decomposition
(dqrdc and dqrsl), singular
value decomposition (dsvdc), and LU decomposition
(dgefa, dgesl, and dgedi) routines. The nonprofit Society for Industrial and Applied
Mathematics (SIAM) sells copies of the
LINPACK
Users' Guide.
New as of 8/7/98: Numerical analysts at MathWorks and NIST have combined to produce a public domain Java linear algebra package called JAMA. (MathWorks maintains links to a variety of Java-based tools for science and engineering at http://www.mathtools.net/Java/index.html.)
New as of 2/24/99: G.W. Stewart has produced a public domain Java linear algebra package called Jampack.
New as of 7/21/99: A US Government NIST (National Institute of Standards and Technology) site links to a wide variety of numerical Java resources.
New as of 7/21/99: Links to proprietary Java linear algebra packages.
for (i = 1; i <= n; i++)rather than
for (i = 0; i < n; i++)To use the "_f77" routines you will have to declare your vectors and matrices to be one element larger (e.g., v[101] rather than v[100], and a[101][101] rather than a[100][100]), and you will have to fill elements 1 through n rather than elements 0 through n - 1.
The classes/methods that make use of Java/C style indexing have "_j" suffixes. In these you will tend to see
for (i = 0; i < n; i++)rather than
for (i = 1; i <= n; i++)To use the "_j" routines you will have to fill elements 0 through n - 1 rather than elements 1 through n.
Why would one use the "_f77" material? If you were translating a FORTRAN program and didn't want to worry about the effects of changing index values, you could use the "_f77" routines. Of course, these waste memory.
I have tested the Cholesky.class and Triangular.class programs with CholTest. For reasonably scaled, well-conditioned problems, they appear to perform satisfactorily for matrices of order 50. As I am a statistician interested in regression problems, this is sufficient for many of my purposes. If you need to deal with larger problems, I STRONGLY encourage you to use CholTest to investigate whether these routines will be satisfactory for your purposes.
Sorry about that.
Given the manner in which the routines are currently written, you will need to import them (see the beginning of CholTest_f77.java). All of the classes will have to be placed in subdirectories of a directory in your CLASSPATH. For the linear algebra classes, this subdirectory will have to be called linear_algebra. Console.class will have to be placed in a subdirectory called corejava.
Note that if you install the software in this manner,
then to run, for example, CholTest_f77 you will have to issue the command:
java linear_algebra.CholTest_f77Alternatively, you could remove the package statements in the *.java files (and the import linear_algebra and import corejava statements from CholTest_f77.java, QRTest_f77.java, SVDCTest_f77.java, LUTest_f77.java, CholTest_j.java, QRTest_j.java, SVDCTest_j.java, LUTest_j.java, and CholTest.java), and compile these files in the same directory in which you are compiling the java code that calls them.
} else if (n == 1) { norm = Math.abs(x[1]);was incorrect. It needed to be changed to
} else if (n == 1) { norm = Math.abs(x[0]);I thank Jon Campbell for detecting this error.