public void dswap(DoubleMatrix2D A, DoubleMatrix2D B) { //B.swap(A); not yet implemented A.checkShape(B); for(int i = A.rows(); --i >= 0;) A.viewRow(i).swap(B.viewRow(i)); } public void dsymv(boolean isUpperTriangular, double alpha, DoubleMatrix2D A, DoubleMatrix1D x, double beta, DoubleMatrix1D y) {
public void dswap(DoubleMatrix2D A, DoubleMatrix2D B) { //B.swap(A); not yet implemented A.checkShape(B); for(int i = A.rows(); --i >= 0;) A.viewRow(i).swap(B.viewRow(i)); } public void dsymv(boolean isUpperTriangular, double alpha, DoubleMatrix2D A, DoubleMatrix1D x, double beta, DoubleMatrix1D y) {
/** * Returns the infinity norm of matrix <tt>A</tt>, which is the maximum absolute row sum. */ public double normInfinity(DoubleMatrix2D A) { double max = 0; for (int row = A.rows(); --row >=0; ) { //max = Math.max(max, normInfinity(A.viewRow(row))); max = Math.max(max, norm1(A.viewRow(row))); } return max; } /**
/** * Returns the infinity norm of matrix <tt>A</tt>, which is the maximum absolute row sum. */ public double normInfinity(DoubleMatrix2D A) { double max = 0; for (int row = A.rows(); --row >=0; ) { //max = Math.max(max, normInfinity(A.viewRow(row))); max = Math.max(max, norm1(A.viewRow(row))); } return max; } /**
public void dger(double alpha, DoubleMatrix1D x, DoubleMatrix1D y, DoubleMatrix2D A) { cern.jet.math.PlusMult fun = cern.jet.math.PlusMult.plusMult(0); for (int i=A.rows(); --i >= 0; ) { fun.multiplicator = alpha * x.getQuick(i); A.viewRow(i).assign(y,fun); } } public double dnrm2(DoubleMatrix1D x) {
/** * Returns a string representations of all cells; no alignment considered. */ public String[][] format(DoubleMatrix2D matrix) { String[][] strings = new String[matrix.rows()][matrix.columns()]; for (int row=matrix.rows(); --row >= 0; ) strings[row] = formatRow(matrix.viewRow(row)); return strings; } /**
/** * Returns a string representation of the given matrix. * @param matrix the matrix to convert. */ public String toString(DoubleMatrix1D matrix) { DoubleMatrix2D easy = matrix.like2D(1,matrix.size()); easy.viewRow(0).assign(matrix); return toString(easy); } /**
/** * Returns a string representation of the given matrix. * @param matrix the matrix to convert. */ public String toString(DoubleMatrix1D matrix) { DoubleMatrix2D easy = matrix.like2D(1,matrix.size()); easy.viewRow(0).assign(matrix); return toString(easy); } /**
public void dger(double alpha, DoubleMatrix1D x, DoubleMatrix1D y, DoubleMatrix2D A) { cern.jet.math.PlusMult fun = cern.jet.math.PlusMult.plusMult(0); for (int i=A.rows(); --i >= 0; ) { fun.multiplicator = alpha * x.getQuick(i); A.viewRow(i).assign(y,fun); } } public double dnrm2(DoubleMatrix1D x) {
/** * Returns a string representations of all cells; no alignment considered. */ public String[][] format(DoubleMatrix2D matrix) { String[][] strings = new String[matrix.rows()][matrix.columns()]; for (int row=matrix.rows(); --row >= 0; ) strings[row] = formatRow(matrix.viewRow(row)); return strings; } /**
/** * Normalizes matrix of p(z|u) such that \forall_u: \sum_z p(z|u) = 1. * * @param pu_z normalized matrix of p(z|u) */ @Override protected void normalizePuz(DoubleMatrix2D pu_z) { for (int u = 0; u < pu_z.rows(); u++) { DoubleMatrix1D tmp = pu_z.viewRow(u); double norm = tmp.aggregate(Functions.plus, Functions.identity); if (norm != 0.0) { tmp.assign(Functions.mult(1 / norm)); } } }
/** * Inequality functions gradients values at X. */ protected DoubleMatrix2D getGradFi(DoubleMatrix1D X) { DoubleMatrix2D ret = F2.make(request.getFi().length, X.size()); double[] x = X.toArray(); for(int i=0; i<request.getFi().length; i++){ ret.viewRow(i).assign(request.getFi()[i].gradient(x)); } return ret; }