Package org.apache.mahout.math.function

Examples of org.apache.mahout.math.function.IntDoubleProcedure


      return this;
    }

    if (function == Functions.mult) { // x[i] = x[i] * y[i]
      this.elements.forEachPair(
          new IntDoubleProcedure() {
            public boolean apply(int key, double value) {
              int i = key / columns;
              int j = key % columns;
              double r = value * y.getQuick(i, j);
              if (r != value) {
                elements.put(key, r);
              }
              return true;
            }
          }
      );
    }

    if (function == Functions.div) { // x[i] = x[i] / y[i]
      this.elements.forEachPair(
          new IntDoubleProcedure() {
            public boolean apply(int key, double value) {
              int i = key / columns;
              int j = key % columns;
              double r = value / y.getQuick(i, j);
              if (r != value) {
View Full Code Here


  @Override
  public DoubleMatrix2D forEachNonZero(final org.apache.mahout.math.function.IntIntDoubleFunction function) {
    if (this.isNoView) {
      this.elements.forEachPair(
          new IntDoubleProcedure() {
            public boolean apply(int key, double value) {
              int i = key / columns;
              int j = key % columns;
              double r = function.apply(i, j, value);
              if (r != value) {
View Full Code Here

    if (yElements == null || zElements == null) {
      throw new InternalError();
    }

    this.elements.forEachPair(
        new IntDoubleProcedure() {
          public boolean apply(int key, double value) {
            int i = key / columns;
            int j = key % columns;
            if (transposeA) {
              int tmp = i;
View Full Code Here

    }

    final PlusMult fun = PlusMult.plusMult(0);

    this.elements.forEachPair(
        new IntDoubleProcedure() {
          public boolean apply(int key, double value) {
            int i = key / columns;
            int j = key % columns;
            fun.setMultiplicator(value * alpha);
            if (!transposeA) {
View Full Code Here

   *
   * @return <tt>true</tt> if the receiver contains the specified value.
   */
  public boolean containsValue(final double value) {
    return !forEachPair(
        new IntDoubleProcedure() {
          @Override
          public boolean apply(int iterKey, double iterValue) {
            return (value != iterValue);
          }
        }
View Full Code Here

      return false;
    }

    return
        forEachPair(
            new IntDoubleProcedure() {
              @Override
              public boolean apply(int key, double value) {
                return other.containsKey(key) && other.get(key) == value;
              }
            }
        )
            &&
            other.forEachPair(
                new IntDoubleProcedure() {
                  @Override
                  public boolean apply(int key, double value) {
                    return containsKey(key) && get(key) == value;
                  }
                }
View Full Code Here

                           final DoubleArrayList valueList) {
    keyList.clear();
    valueList.clear();

    forEachPair(
        new IntDoubleProcedure() {
          @Override
          public boolean apply(int key, double value) {
            if (condition.apply(key, value)) {
              keyList.add(key);
              valueList.add(value);
View Full Code Here

   *
   * @param function a function object taking as argument the current association's value.
   */
  public void assign(final DoubleFunction function) {
    copy().forEachPair(
        new IntDoubleProcedure() {
          @Override
          public boolean apply(int key, double value) {
            put(key, function.apply(value));
            return true;
          }
View Full Code Here

   * @param other the other map to be copied into the receiver.
   */
  public void assign(AbstractIntDoubleMap other) {
    clear();
    other.forEachPair(
        new IntDoubleProcedure() {
          @Override
          public boolean apply(int key, double value) {
            put(key, value);
            return true;
          }
View Full Code Here

      return this;
    }

    if (function == Functions.MULT) { // x[i] = x[i] * y[i]
      this.elements.forEachPair(
          new IntDoubleProcedure() {
            @Override
            public boolean apply(int key, double value) {
              int i = key / columns;
              int j = key % columns;
              double r = value * y.getQuick(i, j);
              if (r != value) {
                elements.put(key, r);
              }
              return true;
            }
          }
      );
    }

    if (function == Functions.DIV) { // x[i] = x[i] / y[i]
      this.elements.forEachPair(
          new IntDoubleProcedure() {
            @Override
            public boolean apply(int key, double value) {
              int i = key / columns;
              int j = key % columns;
              double r = value / y.getQuick(i, j);
View Full Code Here

TOP

Related Classes of org.apache.mahout.math.function.IntDoubleProcedure

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.