Package org.apache.mahout.math.matrix

Examples of org.apache.mahout.math.matrix.DoubleMatrix1D.assign()


    }

    DoubleMatrix1D b = x.like();
    DoubleMatrix1D y = x.like();
    if (isUnitTriangular) {
      y.assign(1);
    } else {
      for (int i = 0; i < size; i++) {
        y.setQuick(i, A.getQuick(i, i));
      }
    }
View Full Code Here


    // Outer loop.
    int CUT_OFF = 10;
    for (int j = 0; j < n; j++) {
      // blocking (make copy of j-th column to localize references)
      LUcolj.assign(LU.viewColumn(j));

      // sparsity detection
      int maxCardinality = m / CUT_OFF; // == heuristic depending on speedup
      LUcolj.getNonZeros(nonZeroIndexes, null, maxCardinality);
      int cardinality = nonZeroIndexes.size();
View Full Code Here

    // Solve L*Y = B(piv,:)
    int CUT_OFF = 10;
    for (int k = 0; k < n; k++) {
      // blocking (make copy of k-th row to localize references)
      Browk.assign(Brows[k]);

      // sparsity detection
      int maxCardinality = nx / CUT_OFF; // == heuristic depending on speedup
      Browk.getNonZeros(nonZeroIndexes, null, maxCardinality);
      int cardinality = nonZeroIndexes.size();
View Full Code Here

      // blocking
      if (Browk == null) {
        Browk = org.apache.mahout.math.matrix.DoubleFactory1D.dense.make(B.columns());
      }
      Browk.assign(Brows[k]);

      // sparsity detection
      int maxCardinality = nx / CUT_OFF; // == heuristic depending on speedup
      Browk.getNonZeros(nonZeroIndexes, null, maxCardinality);
      int cardinality = nonZeroIndexes.size();
View Full Code Here

      for (int j = k; j < n; j++) {
        if (QR.getQuick(k, k) != 0) {
          DoubleMatrix1D Qcolj = Q.viewColumn(j).viewPart(k, m - k);
          double s = QRcolk.zDotProduct(Qcolj);
          s = -s / QR.getQuick(k, k);
          Qcolj.assign(QRcolk, Functions.plusMult(s));
        }
      }
    }
    return Q;
  }
View Full Code Here

    // Outer loop.
    int cutOff = 10;
    for (int j = 0; j < n; j++) {
      // blocking (make copy of j-th column to localize references)
      luColj.assign(lu.viewColumn(j));

      // sparsity detection
      int maxCardinality = m / cutOff; // == heuristic depending on speedup
      luColj.getNonZeros(nonZeroIndexes, null, maxCardinality);
      int cardinality = nonZeroIndexes.size();
View Full Code Here

    // Solve L*Y = B(piv,:)
    int cutOff = 10;
    for (int k = 0; k < n; k++) {
      // blocking (make copy of k-th row to localize references)
      bRowk.assign(brows[k]);

      // sparsity detection
      int maxCardinality = nx / cutOff; // == heuristic depending on speedup
      bRowk.getNonZeros(nonZeroIndexes, null, maxCardinality);
      int cardinality = nonZeroIndexes.size();
View Full Code Here

      // blocking
      //if (bRowk == null) {
      //  bRowk = org.apache.mahout.math.matrix.DoubleFactory1D.dense.make(B.columns());
      //}
      bRowk.assign(brows[k]);

      // sparsity detection
      int maxCardinality = nx / cutOff; // == heuristic depending on speedup
      bRowk.getNonZeros(nonZeroIndexes, null, maxCardinality);
      int cardinality = nonZeroIndexes.size();
View Full Code Here

      for (int j = k; j < n; j++) {
        if (QR.getQuick(k, k) != 0) {
          DoubleMatrix1D Qcolj = Q.viewColumn(j).viewPart(k, m - k);
          double s = QRcolk.zDotProduct(Qcolj);
          s = -s / QR.getQuick(k, k);
          Qcolj.assign(QRcolk, Functions.plusMult(s));
        }
      }
    }
    return Q;
  }
View Full Code Here

        // so we need to calculate the centroid here once again based
        // on the cluster's documents.
        final DoubleMatrix1D centroid = new DenseDoubleMatrix1D(termDocumentMatrix.rows());
        for (IntCursor d : documents)
        {
            centroid.assign(termDocumentMatrix.viewColumn(d.value), Functions.PLUS);
        }

        final List<String> labels = Lists.newArrayListWithCapacity(labelCount);

        final int [] order = IndirectSort.mergesort(0, centroid.size(),
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.