Package water

Examples of water.MRTask$MRProfile


   * A.numCols() == d.size()
   */
  private static Frame execDiagonal(final Frame A, Vector d) {
    final H2OBCast<Vector> bd = new H2OBCast<Vector>(d);

    return new MRTask() {
      public void map(Chunk chks[], NewChunk ncs[]) {
        Vector D = bd.value();
        int chunkSize = chks[0].len();

        for (int c = 0; c < ncs.length; c++) {
View Full Code Here


   * A.numCols() == b.rowSize()
   */
  private static Frame execCommon(final Frame A, Matrix b) {
    final H2OBCast<Matrix> bb = new H2OBCast<Matrix>(b);

    return new MRTask() {
      public void map(Chunk chks[], NewChunk ncs[]) {
        Matrix B = bb.value();
        int chunkSize = chks[0].len();

        for (int c = 0; c < ncs.length; c++) {
View Full Code Here

    // Ax is written into nc (single element, not array) with an MRTask on A,
    // and therefore will be similarly partitioned as A.
    //
    // x.size() == A.numCols() == chks.length
    Frame Ax = new MRTask() {
        public void map(Chunk chks[], NewChunk nc) {
          int chunkSize = chks[0].len();
          Vector x = bx.value();

          for (int r = 0; r < chunkSize; r++) {
View Full Code Here

    Frame A = drmA.frame;
    Vec keys = drmA.keys;

    // Run a filtering MRTask on A. If row number falls within R.start() and
    // R.end(), then the row makes it into the output
    Frame Arr = new MRTask() {
        public void map(Chunk chks[], NewChunk ncs[]) {
          int chunkSize = chks[0].len();
          long chunkStart = chks[0].start();

          // First check if the entire chunk even overlaps with R
          if (chunkStart > R.end() || (chunkStart + chunkSize) < R.start()) {
            return;
          }

          // This chunk overlaps, filter out just the overlapping rows
          for (int r = 0; r < chunkSize; r++) {
            if (!R.contains(chunkStart + r)) {
              continue;
            }

            for (int c = 0; c < chks.length; c++) {
              ncs[c].addNum(chks[c].at0(r));
            }
          }
        }
      }.doAll(A.numCols(), A).outputFrame(null, null);

    Vec Vrr = (keys == null) ? null : new MRTask() {
        // This is a String keyed DRM. Do the same thing as above,
        // but this time just one column of Strings.
        public void map(Chunk chk, NewChunk nc) {
          int chunkSize = chk.len();
          long chunkStart = chk.start();
View Full Code Here

    // AewB is written into ncs[] with an MRTask on A, and therefore will
    // be similarly partitioned as A.
    //
    // B may or may not be similarly partitioned as A, but must have the
    // same dimensions of A.
    Frame AewB = new MRTask() {
        private double opfn(String op, double a, double b) {
          if (a == 0.0 && b == 0.0) {
            return 0.0;
          }
          if (op.equals("+")) {
View Full Code Here

    // cross the wire during copy. B's data could potentially cross the wire.
    Frame frbind = H2OHelper.emptyFrame(fra.numRows() + frb.numRows(), fra.numCols(),
            -1, -1, fra.anyVec().group());
    Vec keys = null;

    MRTask task = new MRTask() {
        public void map(Chunk chks[], NewChunk nc) {
          Vec A_vecs[] = fra.vecs();
          Vec B_vecs[] = frb.vecs();
          long A_rows = fra.numRows();
          long B_rows = frb.numRows();
          long start = chks[0].start();
          int chunkSize = chks[0].len();
          ValueString vstr = new ValueString();

          for (int r = 0; r < chunkSize; r++) {
            for (int c = 0; c < chks.length; c++) {
              if (r + start < A_rows) {
                chks[c].set0(r, A_vecs[c].at(r + start));
                if (keysa != null) {
                  nc.addStr(keysa.atStr(vstr, r + start));
                }
              } else {
                chks[c].set0(r, B_vecs[c].at(r + start - A_rows));
                if (keysb != null) {
                  nc.addStr(keysb.atStr(vstr, r + start - A_rows));
                }
              }
            }
          }
        }
      };

    if (keysa == null) {
      keys = task.doAll(1, frbind).outputFrame(null, null).anyVec();
    } else {
      task.doAll(frbind);
    }

    return new H2ODrm(frbind, keys);
  }
View Full Code Here

    Vec keys = drmA.keys;
    int AewScalar_cols = A.numCols();

    // AewScalar is written into ncs[] with an MRTask on A, and therefore will
    // be similarly partitioned as A.
    Frame AewScalar = new MRTask() {
        private double opfn(String op, double a, double b) {
          if (a == 0.0 && b == 0.0) {
            return 0.0;
          }
          if (op.equals("+")) {
View Full Code Here

      bvecs[i] = fra.anyVec().makeZero();
    }

    // Next run an MRTask on the new vectors, and fill each cell (initially 0)
    // by pulling in appropriate values from B (frb)
    new MRTask() {
      public void map(Chunk chks[]) {
        int chunkSize = chks[0].len();
        long start = chks[0].start();
        Vec vecs[] = frb.vecs();
View Full Code Here

      // The new String Vec will therefore be similarly partitioned as the
      // new Frame.
      //
      // vout is finally collected by calling anyVec() on outputFrame(),
      // as it is the only column in the output frame.
      vout = new MRTask() {
          public void map(Chunk chks[], NewChunk nc) {
            int chunkSize = chks[0].len();
            Vec vins[] = frin.vecs();
            long start = chks[0].start();
            ValueString vstr = new ValueString();

            for (int r = 0; r < chunkSize; r++) {
              for (int c = 0; c < chks.length; c++) {
                chks[c].set0(r, vins[c].at(start + r));
              }
              nc.addStr(vin.atStr(vstr, start + r));
            }
          }
        }.doAll(1, frout).outputFrame(null, null).anyVec();
    } else {
      // If not String keyed, then run and MRTask on the new frame, and
      // just pull in right elements from frin
      new MRTask() {
        public void map(Chunk chks[]) {
          int chunkSize = chks[0].len();
          Vec vins[] = frin.vecs();
          long start = chks[0].start();
View Full Code Here

    // and A.numRows() columns.
    Frame At = H2OHelper.emptyFrame(A.numCols(), (int) A.numRows(), -1, -1);

    // Execute MRTask on the new frame, and fill each cell (initially 0) by
    // pulling in the appropriate value from A.
    new MRTask() {
      public void map(Chunk chks[]) {
        int chunkSize = chks[0].len();
        long start = chks[0].start();
        Vec A_vecs[] = A.vecs();
View Full Code Here

TOP

Related Classes of water.MRTask$MRProfile

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.