Examples of viewPart()


Examples of org.apache.mahout.math.DenseVector.viewPart()

    v.assign(0);
    v.viewDiagonal().assign(1);

    for (int m = high - 1; m >= low + 1; m--) {
      if (hessenBerg.getQuick(m, m - 1) != 0.0) {
        ort.viewPart(m + 1, high - m).assign(hessenBerg.viewColumn(m - 1).viewPart(m + 1, high - m));
        for (int j = m; j <= high; j++) {
          double g = ort.viewPart(m, high - m + 1).dot(v.viewColumn(j).viewPart(m, high - m + 1));
          // Double division avoids possible underflow
          g = g / ort.getQuick(m) / hessenBerg.getQuick(m, m - 1);
          v.viewColumn(j).viewPart(m, high - m + 1).assign(ort.viewPart(m, high - m + 1), Functions.plusMult(g));
View Full Code Here

Examples of org.apache.mahout.math.Matrix.viewPart()

public class UpperTriangularTest extends MahoutTestCase {
  @Test
  public void testBasics() {
    Matrix a = new UpperTriangular(new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, false);
    assertEquals(0, a.viewDiagonal().minus(new DenseVector(new double[]{1, 5, 8, 10})).norm(1), 1.0e-10);
    assertEquals(0, a.viewPart(0, 3, 1, 3).viewDiagonal().minus(
        new DenseVector(new double[]{2, 6, 9})).norm(1), 1.0e-10);
    assertEquals(4, a.get(0, 3), 1.0e-10);
    print(a);
    Matrix m = new DenseMatrix(4, 4).assign(a);
    assertEquals(0, m.minus(a).aggregate(Functions.PLUS, Functions.ABS), 1.0e-10);
View Full Code Here

Examples of org.apache.mahout.math.Matrix.viewPart()

        //System.out.printf("%d\t%d\t%d\t%d\n", i, s0.size(), s5.size(), s9.size());
        if (i > 900) {
          double predict5 = predictSize(m5.viewPart(0, k, 0, 3), i, 0.5);
          assertEquals(predict5, Math.log(s5.size()), 1);

          double predict9 = predictSize(m9.viewPart(0, k, 0, 3), i, 0.9);
          assertEquals(predict9, Math.log(s9.size()), 1);

          //assertEquals(10.5 * Math.log(i) - offset0, s0.size(), 10);
        } else if (i > 50) {
          double x = 10.5 * Math.log(i) - s0.size();
View Full Code Here

Examples of org.apache.mahout.math.Matrix.viewPart()

        // now we can set an upper bound on how large our result will be
        nrows = m.get().rowSize() * files.size();
        ncols = m.get().columnSize();
        r = new DenseMatrix(nrows, ncols);
      }
      r.viewPart(row, m.get().rowSize(), 0, r.columnSize()).assign(m.get());
      row += m.get().rowSize();
    }
    // at the end, row will have the true size of the result
    if (row != nrows && r != null) {
      // and if that isn't the size of the buffer, we need to crop the result a bit
View Full Code Here

Examples of org.apache.mahout.math.Matrix.viewPart()

      row += m.get().rowSize();
    }
    // at the end, row will have the true size of the result
    if (row != nrows && r != null) {
      // and if that isn't the size of the buffer, we need to crop the result a bit
      r = r.viewPart(0, row, 0, ncols);
    }
    return r;
  }

  @Test
View Full Code Here

Examples of org.apache.mahout.math.Matrix.viewPart()

    Matrix v = new RandomTrinaryMatrix(2, columns, rank, false);
    Matrix a = u.times(d).times(v.transpose());

    if (tmpDir != null) {
      for (int i = 0; i < a.rowSize(); i += rowsPerSlice) {
        MatrixWritable m = new MatrixWritable(a.viewPart(i, Math.min(a.rowSize() - i, rowsPerSlice), 0, a.columnSize()));
        DataOutputStream out = new DataOutputStream(new FileOutputStream(new File(tmpDir, String.format("%s-%09d", aBase, i))));
        try {
          m.write(out);
        } finally {
          out.close();
View Full Code Here

Examples of org.apache.mahout.math.SequentialAccessSparseVector.viewPart()

              : rowCount, 1);
      } else if (aCols[col].size() < rowCount) {
        Vector newVec =
          new SequentialAccessSparseVector(rowCount + blockHeight,
                                           aCols[col].getNumNondefaultElements() << 1);
        newVec.viewPart(0, aCols[col].size()).assign(aCols[col]);
        aCols[col] = newVec;
      }
    }

    @Override
View Full Code Here

Examples of org.apache.mahout.math.SequentialAccessSparseVector.viewPart()

                                           1);
      } else if (aCols[col].size() < rowCount) {
        Vector newVec =
          new SequentialAccessSparseVector(rowCount << 1,
                                           aCols[col].getNumNondefaultElements() << 1);
        newVec.viewPart(0, aCols[col].size()).assign(aCols[col]);
        aCols[col] = newVec;
      }
    }

    @Override
View Full Code Here

Examples of org.apache.mahout.math.SequentialAccessSparseVector.viewPart()

              : rowCount, 1);
      } else if (aCols[col].size() < rowCount) {
        Vector newVec =
          new SequentialAccessSparseVector(rowCount + blockHeight,
                                           aCols[col].getNumNondefaultElements() << 1);
        newVec.viewPart(0, aCols[col].size()).assign(aCols[col]);
        aCols[col] = newVec;
      }
    }

    @Override
View Full Code Here

Examples of org.apache.mahout.math.SequentialAccessSparseVector.viewPart()

                                           1);
      } else if (aCols[col].size() < rowCount) {
        Vector newVec =
          new SequentialAccessSparseVector(rowCount << 1,
                                           aCols[col].getNumNondefaultElements() << 1);
        newVec.viewPart(0, aCols[col].size()).assign(aCols[col]);
        aCols[col] = newVec;
      }
    }

    @Override
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.