Package org.apache.mahout.math

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


    m.setQuick(1, 2, 6);
    m.setQuick(2, 0, 7);
    m.setQuick(2, 1, 8);
    m.setQuick(2, 2, 9);

    GivensThinSolver qrSolver = new GivensThinSolver(m.rowSize(), m.columnSize());
    qrSolver.solve(m);

    Matrix qtm = new DenseMatrix(qrSolver.getThinQtTilde());

    assertOrthonormality(qtm.transpose(), false, SVD_EPSILON);
View Full Code Here


    m.setQuick(2, 0, 7);
    m.setQuick(2, 1, 8);
    m.setQuick(2, 2, 9);

    GivensThinSolver qrSolver =
      new GivensThinSolver(m.rowSize(), m.columnSize());
    qrSolver.solve(m);

    Matrix qtm = new DenseMatrix(qrSolver.getThinQtTilde());

    assertOrthonormality(qtm.transpose(), false, SVD_EPSILON);
View Full Code Here

        m.readFields(in);
      } finally {
        in.close();
      }
      Matrix aI = m.get();
      ncols = Math.max(ncols, aI.columnSize());

      Matrix omega = new RandomTrinaryMatrix(seed, aI.numCols(), internalDimension, false);
      for (int j = 0; j < aI.numCols(); j += columnsPerSlice) {
        Matrix yI = aI.times(omega);
        Matrix aIJ = aI.viewPart(0, aI.rowSize(), j, Math.min(columnsPerSlice, aI.columnSize() - j));
View Full Code Here

        // 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

    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

    m.setQuick(1, 2, 6);
    m.setQuick(2, 0, 7);
    m.setQuick(2, 1, 8);
    m.setQuick(2, 2, 9);

    GivensThinSolver qrSolver = new GivensThinSolver(m.rowSize(), m.columnSize());
    qrSolver.solve(m);

    Matrix qtm = new DenseMatrix(qrSolver.getThinQtTilde());

    assertOrthonormality(qtm.transpose(), false, SVD_EPSILON);
View Full Code Here

        m.readFields(in);
      } finally {
        in.close();
      }
      Matrix aI = m.get();
      ncols = Math.max(ncols, aI.columnSize());

      Matrix omega = new RandomTrinaryMatrix(seed, aI.numCols(), internalDimension, false);
      for (int j = 0; j < aI.numCols(); j += columnsPerSlice) {
        Matrix yI = aI.times(omega);
        Matrix aIJ = aI.viewPart(0, aI.rowSize(), j, Math.min(columnsPerSlice, aI.columnSize() - j));
View Full Code Here

    this.weightMatrixList = Lists.newArrayList();
    this.prevWeightUpdatesList = Lists.newArrayList();
    for (int i = 0; i < numOfMatrices; i++) {
      Matrix matrix = MatrixWritable.readMatrix(input);
      this.weightMatrixList.add(matrix);
      this.prevWeightUpdatesList.add(new DenseMatrix(matrix.rowSize(), matrix.columnSize()));
    }
  }

}
View Full Code Here

        m.readFields(in);
      } finally {
        in.close();
      }
      Matrix aI = m.get();
      ncols = Math.max(ncols, aI.columnSize());

      Matrix omega = new RandomTrinaryMatrix(seed, aI.numCols(), internalDimension, false);
      for (int j = 0; j < aI.numCols(); j += columnsPerSlice) {
        Matrix yI = aI.times(omega);
        Matrix aIJ = aI.viewPart(0, aI.rowSize(), j, Math.min(columnsPerSlice, aI.columnSize() - j));
View Full Code Here

        // 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

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.