I am applying SVD to a term - document matrix that i have already created.The matrix is a double array of the form :
public static double[][] tdidf;
tdidf = new double[listOfFiles.length][keywordList.size()];
But when i apple svd :
public void computeSVD()
{
Matrix A = new Matrix(tdidf); SingularValueDecomposition svd = A.svd();
Matrix U = svd.getU();
Matrix S = svd.getS();
}
i am getting an error :
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 53
at Jama.SingularValueDecomposition.getS(SingularValueDecomposition.java:511)
at TDIDF_Matrix.computeSVD(TDIDF_Matrix.java:119)
at Jama.main(Jama.java:191)
Do i need to transpose A before computing SVD?