/** * Constructs a function that returns <tt>a / b</tt>. * <tt>a</tt> is a variable, <tt>b</tt> is fixed. */ public static DoubleFunction div(final double b) { return mult(1 / b); } /**
/** * Constructs a function that returns <tt>a / b</tt>. * <tt>a</tt> is a variable, <tt>b</tt> is fixed. */ public static DoubleFunction div(final double b) { return mult(1 / b); } /**
/** * <tt>A = A * s <=> A[row,col] = A[row,col] * s</tt>. * @param A the matrix to modify. * @param s the scalar; can have any value. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix2D mult(DoubleMatrix2D A, double s) { return A.assign(F.mult(s)); } /**
public void apply(cern.colt.Timer timer) { cern.colt.matrix.linalg.SmpBlas.smpBlas.assign(A,cern.jet.math.Functions.mult(0.5)); } };
/** * <tt>A = -A <=> A[row,col] = -A[row,col]</tt>. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix2D negate(DoubleMatrix2D A) { return A.assign(F.mult(-1)); } /**
/** * <tt>A = -A <=> A[i] = -A[i]</tt> for all cells. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D negate(DoubleMatrix1D A) { return A.assign(F.mult(-1)); } /**
/** * <tt>A = -A <=> A[row,col] = -A[row,col]</tt>. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix2D negate(DoubleMatrix2D A) { return A.assign(F.mult(-1)); } /**
/** * <tt>A = A * s <=> A[i] = A[i] * s</tt>. * @param A the matrix to modify. * @param s the scalar; can have any value. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D mult(DoubleMatrix1D A, double s) { return A.assign(F.mult(s)); } /**
/** * <tt>A = A * s <=> A[row,col] = A[row,col] * s</tt>. * @param A the matrix to modify. * @param s the scalar; can have any value. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix2D mult(DoubleMatrix2D A, double s) { return A.assign(F.mult(s)); } /**
/** * <tt>A = -A <=> A[i] = -A[i]</tt> for all cells. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D negate(DoubleMatrix1D A) { return A.assign(F.mult(-1)); } /**
/** * <tt>A = A * s <=> A[i] = A[i] * s</tt>. * @param A the matrix to modify. * @param s the scalar; can have any value. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D mult(DoubleMatrix1D A, double s) { return A.assign(F.mult(s)); } /**
public void dscal(double alpha, DoubleMatrix2D A) { A.assign(F.mult(alpha)); }
public void apply(cern.colt.Timer timer) { cern.colt.matrix.linalg.SmpBlas.smpBlas.assign(A,cern.jet.math.Functions.mult(0.5)); } };
/** * Normalizes matrix of p(i|z) such that \sum_{i, z} p(i|z) = 1. * * @param piz normalized matrix of p(i|z) */ protected void normalizePiz(DoubleMatrix2D piz) { piz.assign(mult(1 / piz.aggregate(plus, identity))); }
/** * Normalizes matrix of p(z|u) such that \forall_z: \sum_u p(z|u) = 1. * * @param pu_z normalized matrix of p(z|u) */ protected void normalizePuz(DoubleMatrix2D pu_z) { for (int z = 0; z < pu_z.columns(); z++) { final DoubleMatrix1D pu_Z = pu_z.viewColumn(z); pu_Z.assign(mult(1 / pu_Z.aggregate(plus, identity))); } }
public Matrix times(double value) { Matrix result = new ColtSparseDoubleMatrix2D((SparseDoubleMatrix2D) matrix.copy().assign(Functions.mult(value))); MapMatrix<String, Object> a = getMetaData(); if (a != null) { result.setMetaData(a.clone()); } return result; }
public Matrix times(double value) { Matrix result = new ColtDenseDoubleMatrix2D((DenseDoubleMatrix2D) matrix.copy().assign(Functions.mult(value))); MapMatrix<String, Object> a = getMetaData(); if (a != null) { result.setMetaData(a.clone()); } return result; }
public Matrix times(double value) { Matrix result = new ColtSparseDoubleMatrix2D((SparseDoubleMatrix2D) matrix.copy().assign(Functions.mult(value))); MapMatrix<String, Object> a = getMetaData(); if (a != null) { result.setMetaData(a.clone()); } return result; }