|
Dear Sir,
I have a problem of programming with Jama
I write the following code and meet a ArrayIndexOutOfBoundsExceptions Could anybody please tell me how to correct this problem?
Thank you in advance…
@lvin |
import Jama.*;
import Jama.*;
public class TestMat {
public static void main(String[] args) {
double[][] vals = {{2, 3, 1,7},{4, 2, 2, 3},{7, 9, 9, 1}};
Matrix A = new Matrix(vals);
System.out.println("The Matrix A is ");
A.print(3, 0);
System.out.println();
int r = A.rank();
System.out.println("Rank = " +r);
System.out.println();
System.out.println("The Transpose of A is ");
Matrix T = (A.transpose());
T.print(3, 0);
System.out.println();
System.out.println("The SVD of A is ");
SingularValueDecomposition svd = A.svd();
/* Matrix S = svd.getS();
System.out.println("S is ");
S.print(3, 0);
System.out.println();
*/
Matrix U = svd.getU();
System.out.println("U is ");
U.print(5, 0);
System.out.println();
Matrix UT = U.transpose();
System.out.println("U' is ");
UT.print(5, 0);
System.out.println();
Matrix UUT = U.times(UT);
System.out.println("UU' is ");
UUT.print(5, 0);
System.out.println();
}
} // TestMat