public void printPricipalComponents() { System.out.println("PC"); PC.print(PC.getRowDimension(), 4); }
public void printPricipalComponents() { System.out.println("PC"); PC.print(PC.getRowDimension(), 4); }
public double[][] getDataProjected(Matrix data, boolean debug) { // Project the original data set Matrix dataProjected; dataProjected = PC.transpose().times(data); if (debug) { System.out.println("Data projected:"); dataProjected.print(dataProjected.getRowDimension(), 3); } return dataProjected.getArray(); }
public double[][] getDataProjected(Matrix data, boolean debug) { // Project the original data set Matrix dataProjected; dataProjected = PC.transpose().times(data); if (debug) { System.out.println("Data projected:"); dataProjected.print(dataProjected.getRowDimension(), 3); } return dataProjected.getArray(); }
data.print(data.getRowDimension(), 3); if (debug) { System.out.println("Covariance"); covariance.print(covariance.getRowDimension(), 3); if (debug) { System.out.println("EigenValues (on the diagonal)"); pc.getD().print(pc.getD().getRowDimension(), 3); System.out.println("EigenVectors"); pc.getV().print(pc.getV().getRowDimension(), 3); if (debug) { System.out.println("PC:"); PC.print(PC.getRowDimension(), 3);
data.print(data.getRowDimension(), 3); if (debug) { System.out.println("Covariance"); covariance.print(covariance.getRowDimension(), 3); if (debug) { System.out.println("EigenValues (on the diagonal)"); pc.getD().print(pc.getD().getRowDimension(), 3); System.out.println("EigenVectors"); pc.getV().print(pc.getV().getRowDimension(), 3); if (debug) { System.out.println("PC:"); PC.print(PC.getRowDimension(), 3);
/** Print the matrix to stdout. Line the elements up in columns. * Use the format object, and right justify within columns of width * characters. * Note that is the matrix is to be read back in, you probably will want * to use a NumberFormat that is set to US Locale. @param format A Formatting object for individual elements. @param width Field width for each column. @see java.text.DecimalFormat#setDecimalFormatSymbols */ public void print (NumberFormat format, int width) { print(new PrintWriter(System.out,true),format,width); }
/** Print the matrix to stdout. Line the elements up in columns * with a Fortran-like 'Fw.d' style format. @param w Column width. @param d Number of digits after the decimal. */ public void print (int w, int d) { print(new PrintWriter(System.out,true),w,d); }
/** * Generate a {@link String} representation of a matrix. * * @param mat * the matrix * @return a string representation */ public static String toString(Matrix mat) { final StringWriter matWriter = new StringWriter(); mat.print(new PrintWriter(matWriter), 5, 5); return matWriter.getBuffer().toString(); }
Matrix x,y,z; x=Matrix.getMatrix(3,3); y=Matrix.getMatrix(3,3); z=x.plus(y); z.print();
public static void printMatrix(double M_[][]) { Jama.Matrix M = new Jama.Matrix(M_); M.print(5,3); }
public static void printMatrix(double M_[][]) { Jama.Matrix M = new Jama.Matrix(M_); M.print(5,3); }
/** Print the matrix to the output stream. Line the elements up in * columns with a Fortran-like 'Fw.d' style format. @param output Output stream. @param w Column width. @param d Number of digits after the decimal. */ public void print (PrintWriter output, int w, int d) { DecimalFormat format = new DecimalFormat(); format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US)); format.setMinimumIntegerDigits(1); format.setMaximumFractionDigits(d); format.setMinimumFractionDigits(d); format.setGroupingUsed(false); print(output,format,w+2); }
/** Print a row vector. **/ private static void print(double[] x, int w, int d) { // Use format Fw.d for all elements. System.out.print("\n"); new Matrix(x,1).print(w,d); print("\n"); }
public static void main(String[] args) { final Matrix m = new Matrix(new double[][] { { 0.5, 0.4 }, { 0.1, 0.7 } }); final GD_SVD2 gdsvd = new GD_SVD2(m, 2); // m.print(5, 5); // gdsvd.UprimeM.print(5, 5); // gdsvd.UprimeM.times(gdsvd.VprimeM.transpose()).print(5, 5); // gdsvd.UM.times(gdsvd.SM.times(gdsvd.VM)).print(5, 5); // gdsvd.UM.print(5, 5); gdsvd.SM.print(5, 5); // gdsvd.VM.print(5, 5); final ThinSingularValueDecomposition tsvd = new ThinSingularValueDecomposition(m, 2); // tsvd.U.print(5, 5); System.out.println(Arrays.toString(tsvd.S)); } }
public static void main(String[] args) { CovLINard cf = new CovLINard(6); Matrix X = Matrix.identity(6,6); Matrix logtheta = new Matrix(new double[][]{{0.1},{0.2},{0.3},{0.4},{0.5},{0.6}}); Matrix z = new Matrix(new double[][]{{1,2,3,4,5,6},{1,2,3,4,5,6}}); System.out.println(""); //Matrix K = cf.compute(logtheta,X); //K.print(K.getColumnDimension(), 8); //Matrix[] res = cf.compute(logtheta,X,z); //res[0].print(res[0].getColumnDimension(), 8); //res[1].print(res[1].getColumnDimension(), 8); Matrix d = cf.computeDerivatives(logtheta,X,5); d.print(d.getColumnDimension(), 8); } }