org.apache.mahout.math.function
Class PlusMult

java.lang.Object
  extended by org.apache.mahout.math.function.DoubleDoubleFunction
      extended by org.apache.mahout.math.function.PlusMult

public final class PlusMult
extends DoubleDoubleFunction

Only for performance tuning of compute intensive linear algebraic computations. Constructs functions that return one of

a and b are variables, constant is fixed, but for performance reasons publicly accessible. Intended to be passed to matrix.assign(otherMatrix,function) methods.


Constructor Summary
PlusMult(double multiplicator)
           
 
Method Summary
 double apply(double a, double b)
          Returns the result of the function evaluation.
 double getMultiplicator()
           
 boolean isAssociative()
          f(x, f(y, z)) = x + c * (y + c * z) = x + c * y + c^2 * z f(f(x, y), z) = (x + c * y) + c * z = x + c * y + c * z true only for c = 0 or c = 1
 boolean isCommutative()
          x + y * c = y + x * c iff c = 1
 boolean isLikeLeftMult()
          0 + y * c = y * c != 0
 boolean isLikeRightMult()
          x + 0 * c = x != 0
 boolean isLikeRightPlus()
          x + 0 * c = x
static PlusMult minusMult(double constant)
          a - b*constant.
static PlusMult plusMult(double constant)
          a + b*constant.
 void setMultiplicator(double multiplicator)
           
 
Methods inherited from class org.apache.mahout.math.function.DoubleDoubleFunction
isAssociativeAndCommutative, isDensifying, isLikeMult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlusMult

public PlusMult(double multiplicator)
Method Detail

apply

public double apply(double a,
                    double b)
Returns the result of the function evaluation.

Specified by:
apply in class DoubleDoubleFunction
Parameters:
a - a double for the first argument
b - a double for the second argument
Returns:
the result of applying the function

minusMult

public static PlusMult minusMult(double constant)
a - b*constant.


plusMult

public static PlusMult plusMult(double constant)
a + b*constant.


getMultiplicator

public double getMultiplicator()

isLikeRightPlus

public boolean isLikeRightPlus()
x + 0 * c = x

Overrides:
isLikeRightPlus in class DoubleDoubleFunction
Returns:
true iff f(x, 0) = x for any x

isLikeLeftMult

public boolean isLikeLeftMult()
0 + y * c = y * c != 0

Overrides:
isLikeLeftMult in class DoubleDoubleFunction
Returns:
true iff f(0, y) = 0 for any y

isLikeRightMult

public boolean isLikeRightMult()
x + 0 * c = x != 0

Overrides:
isLikeRightMult in class DoubleDoubleFunction
Returns:
true iff f(x, 0) = 0 for any x

isCommutative

public boolean isCommutative()
x + y * c = y + x * c iff c = 1

Overrides:
isCommutative in class DoubleDoubleFunction
Returns:
true iff f(x, y) = f(y, x) for any x, y

isAssociative

public boolean isAssociative()
f(x, f(y, z)) = x + c * (y + c * z) = x + c * y + c^2 * z f(f(x, y), z) = (x + c * y) + c * z = x + c * y + c * z true only for c = 0 or c = 1

Overrides:
isAssociative in class DoubleDoubleFunction
Returns:
true iff f(x, f(y, z)) = f(f(x, y), z) for any x, y, z

setMultiplicator

public void setMultiplicator(double multiplicator)


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.