Re: Java Matrices


At 04:32 AM 8/21/99 -0400, you wrote:
>Attached is a text file with some of our thoughts on Java and Numerical
>Computations.

Here at DynaTech, we use both the Jama Matrix and JNL packages.  I have
looked at the IBM library, and rejected it because it offers nothing the
other 2 don't already have.  I wasn't familiar with the Least Squares
package, however, trying to convert pure procedural code directly into Java
makes little sense.

With respect to Jama and JNL, we prefer the Jama.  There is some
duplication of operators, but Jama has a richer set of matrix routines.  An
extremely nice feature of Jama is the ability to string a long series of
matrix calculations together.  Although you are limited to two dimensional
arrays with Jama, at least for operations, there is no reason why you can't
have higher order arrays, just create an array of Matrix types.  We do this
routinely.  JNL has a complex class which we use, and believe it should be
part of the Java language.  If Jama had complex numerics, we would probably
not use JNL at all.

There is one caveat with Jama which we have found to be careful with.
Although Jama Matrix types are objects, and should therefore be passed by
reference to and from methods, this is not entirely the case.  If you
declare a Jama matrix prior to calling a method, and then re-create (rather
than setting) the matrix in the method, the matrix will be returned
zero-filled.  To avoid this problem, we have either declared all required
Matrices to be class variables, or segment the code into methods which only
return the required Matrix, rather than pass by parameters.  The latter
approach is more object oriented using accessor and mutator methodology.

One serious deficiency in both Jama and JNL is the lack of integration
routines.  We have written our own, using both standard Java arrays and
Jama Matrices.  There seems to be slightly more overhead with the Jama
versions, but not enough to really matter.  We will supply both versions
(source code) to anyone in the technical community free of charge.

We have extensive experience with C/C++, Fortran, and other procedural
languages like PV-Wave.  All things considered, we are happy with Java, and
would not consider doing any new project in any other language.  We have
converted one large procedural code and several miscellaneous subroutines
into Java, so you might say we are hooked.  One thing we are looking at is
the Universal Modeling Language approach to code design, this seems like a
solid, visual approach to generating and maintaining object oriented
programs. 

I wouldn't get so hung up on whether Java is object oriented or not.  You
can argue semantics about what's an object, the pure fact is you can't
write Java programs without using classes, variables, and methods, and
that's object oriented enough for me!  The cross-platform capability of
Java, along with automatic garbage collection, multi-threading, and easy
string manipulation, make the language a good choice for numerical work.


-------------
Lyn Greenhill
DynaTech Engineering, Inc.



Date Index | Thread Index | Problems or questions? Contact list-master@nist.gov