Package org.apache.mahout.math.matrix

Examples of org.apache.mahout.math.matrix.DoubleMatrix3D


   *                              may be expensive, you may want to do it only every 2,4 or 8 iterations.)
   * @return the number of iterations actually executed.
   */
  public static int stencil27(DoubleMatrix3D A, org.apache.mahout.math.function.Double27Function function,
                              int maxIterations, DoubleMatrix3DProcedure hasConverged, int convergenceIterations) {
    DoubleMatrix3D B = A.copy();
    if (convergenceIterations <= 1) {
      convergenceIterations = 2;
    }
    if (convergenceIterations % 2 != 0) {
      convergenceIterations++;
    } // odd -> make it even

    int i = 0;
    while (i < maxIterations) { // do two steps at a time for efficiency
      A.zAssign27Neighbors(B, function);
      B.zAssign27Neighbors(A, function);
      i += 2;
      if (i % convergenceIterations == 0 && hasConverged != null) {
        if (hasConverged.apply(A)) {
          return i;
        }
View Full Code Here


    if (other == this) {
      return this;
    }
    checkShape(other);
    if (haveSharedCells(other)) {
      DoubleMatrix3D c = other.copy();
      if (!(c instanceof DenseDoubleMatrix3D)) { // should not happen
        return super.assign(source);
      }
      other = (DenseDoubleMatrix3D) c;
    }
View Full Code Here

TOP

Related Classes of org.apache.mahout.math.matrix.DoubleMatrix3D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.