Package org.apache.mahout.math.function

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


      final double alpha = ((PlusMult) function).getMultiplicator();
      if (alpha == 0) {
        return this;
      } // nothing to do
      y.forEachNonZero(
          new IntIntDoubleFunction() {
            @Override
            public double apply(int i, int j, double value) {
              setQuick(i, j, getQuick(i, j) + alpha * value);
              return value;
            }
View Full Code Here


    public static DoubleMatrix2D normalizeSparseColumnL2(final DoubleMatrix2D A,
        final double [] work)
    {
        final double [] w = prepareWork(A, work);

        A.forEachNonZero(new IntIntDoubleFunction()
        {
            @Override
            public double apply(int row, int column, double value)
            {
                w[column] += value * value;
                return value;
            }
        });

        // Take the square root
        for (int c = 0; c < A.columns(); c++)
        {
            w[c] = Math.sqrt(w[c]);
        }

        // Normalize
        A.forEachNonZero(new IntIntDoubleFunction()
        {
            @Override
            public double apply(int row, int column, double value)
            {
                A.setQuick(row, column, value / w[column]);
View Full Code Here

TOP

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

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.