Package cern.colt.function

Examples of cern.colt.function.DoubleFunction


/**
* Constructs a function that returns <tt>Math.IEEEremainder(a,b)</tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static DoubleFunction IEEEremainder(final double b) {
  return new DoubleFunction() {
    public final double apply(double a) { return Math.IEEEremainder(a,b); }
  };
}
View Full Code Here


/**
* Constructs a function that returns <tt>a < b ? 1 : 0</tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static DoubleFunction less(final double b) {
  return new DoubleFunction() {
    public final double apply(double a) { return a < b ? 1 : 0; }
  };
}
View Full Code Here

/**
* Constructs a function that returns <tt><tt>Math.log(a) / Math.log(b)</tt></tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static DoubleFunction lg(final double b) {
  return new DoubleFunction() {
    private final double logInv = 1 / Math.log(b); // cached for speed
    public final double apply(double a) { return Math.log(a) * logInv; }
  };
}
View Full Code Here

/**
* Constructs a function that returns <tt>Math.max(a,b)</tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static DoubleFunction max(final double b) {
  return new DoubleFunction() {
    public final double apply(double a) { return Math.max(a,b); }
  };
}
View Full Code Here

/**
* Constructs a function that returns <tt>Math.min(a,b)</tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static DoubleFunction min(final double b) {
  return new DoubleFunction() {
    public final double apply(double a) { return Math.min(a,b); }
  };
}
View Full Code Here

/**
* Constructs a function that returns <tt>a % b</tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static DoubleFunction mod(final double b) {
  return new DoubleFunction() {
    public final double apply(double a) { return a % b; }
  };
}
View Full Code Here

/**
* Constructs a function that returns <tt>a + b</tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static DoubleFunction plus(final double b) {
  return new DoubleFunction() {
    public final double apply(double a) { return a + b; }
  };
}
View Full Code Here

/**
* Constructs a function that returns <tt>Math.pow(a,b)</tt>.
* <tt>a</tt> is a variable, <tt>b</tt> is fixed.
*/
public static DoubleFunction pow(final double b) {
  return new DoubleFunction() {
    public final double apply(double a) { return Math.pow(a,b); }
  };
}
View Full Code Here

* precision = 0.01 rounds 0.012 --> 0.01, 0.018 --> 0.02
* precision = 10   rounds 123   --> 120 , 127   --> 130
* </pre>
*/
public static DoubleFunction round(final double precision) {
  return new DoubleFunction() {
    public final double apply(double a) { return Math.rint(a/precision)*precision; }
  };
}
View Full Code Here

System.out.println(matrix.aggregate(F.mult,F.identity));
//--> 0

// Product( x[i] ) of all x[i] > limit
final double limit = 1;
DoubleFunction f = new DoubleFunction() {
  public final double apply(double a) { return a>limit ? a : 1; }
};
System.out.println(matrix.aggregate(F.mult,f));
//--> 6
View Full Code Here

TOP

Related Classes of cern.colt.function.DoubleFunction

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.