public final double apply(double a, double b) { return function.apply(b,a); } };
public final double apply(double var) { return function.apply(c,var); } };
public final double apply(double var) { return function.apply(c,var); } };
public final double apply(double var) { return function.apply(var,c); } };
public final double apply(double a, double b) { return function.apply(b,a); } };
public final double apply(double var) { return function.apply(var,c); } };
public final double apply(double a, double b) { return g.apply(h.apply(a,b)); } };
public final double apply(double a, double b) { return g.apply(h.apply(a,b)); } };
public final double apply(double a, double b) { return f.apply(g.apply(a), h.apply(b)); } };
public final double apply(double a, double b) { return f.apply(g.apply(a), h.apply(b)); } };
/** * Demonstrates usage of this class. */ public static void demo1() { cern.jet.math.Functions F = cern.jet.math.Functions.functions; double a = 0.5; double b = 0.2; double v = Math.sin(a) + Math.pow(Math.cos(b),2); System.out.println(v); DoubleDoubleFunction f = F.chain(F.plus,F.sin,F.chain(F.square,F.cos)); //DoubleDoubleFunction f = F.chain(plus,sin,F.chain(square,cos)); System.out.println(f.apply(a,b)); DoubleDoubleFunction g = new DoubleDoubleFunction() { public final double apply(double x, double y) { return Math.sin(x) + Math.pow(Math.cos(y),2); } }; System.out.println(g.apply(a,b)); DoubleFunction m = F.plus(3); DoubleFunction n = F.plus(4); System.out.println(m.apply(0)); System.out.println(n.apply(0)); } /**
/** * Demonstrates usage of this class. */ public static void demo1() { cern.jet.math.Functions F = cern.jet.math.Functions.functions; double a = 0.5; double b = 0.2; double v = Math.sin(a) + Math.pow(Math.cos(b),2); System.out.println(v); DoubleDoubleFunction f = F.chain(F.plus,F.sin,F.chain(F.square,F.cos)); //DoubleDoubleFunction f = F.chain(plus,sin,F.chain(square,cos)); System.out.println(f.apply(a,b)); DoubleDoubleFunction g = new DoubleDoubleFunction() { public final double apply(double x, double y) { return Math.sin(x) + Math.pow(Math.cos(y),2); } }; System.out.println(g.apply(a,b)); DoubleFunction m = F.plus(3); DoubleFunction n = F.plus(4); System.out.println(m.apply(0)); System.out.println(n.apply(0)); } /**
/** Assigns the result of a function to each cell; <tt>x[i] = function(x[i],y[i])</tt>. <p> <b>Example:</b> <pre> // assign x[i] = x[i]<sup>y[i]</sup> m1 = 0 1 2 3; m2 = 0 2 4 6; m1.assign(m2, cern.jet.math.Functions.pow); --> m1 == 1 1 16 729 </pre> For further examples, see the <a href="package-summary.html#FunctionObjects">package doc</a>. @param y the secondary matrix to operate on. @param function a function object taking as first argument the current cell's value of <tt>this</tt>, and as second argument the current cell's value of <tt>y</tt>, @return <tt>this</tt> (for convenience only). @throws IllegalArgumentException if <tt>size() != y.size()</tt>. @see cern.jet.math.Functions */ public DoubleMatrix1D assign(DoubleMatrix1D y, cern.colt.function.DoubleDoubleFunction function) { checkSize(y); for (int i=size; --i >= 0; ) { setQuick(i, function.apply(getQuick(i), y.getQuick(i))); } return this; } /**
/** Applies a function to each cell and aggregates the results. Returns a value <tt>v</tt> such that <tt>v==a(size())</tt> where <tt>a(i) == aggr( a(i-1), f(get(i)) )</tt> and terminators are <tt>a(1) == f(get(0)), a(0)==Double.NaN</tt>. <p> <b>Example:</b> <pre> cern.jet.math.Functions F = cern.jet.math.Functions.functions; matrix = 0 1 2 3 // Sum( x[i]*x[i] ) matrix.aggregate(F.plus,F.square); --> 14 </pre> For further examples, see the <a href="package-summary.html#FunctionObjects">package doc</a>. @param aggr an aggregation function taking as first argument the current aggregation and as second argument the transformed current cell value. @param f a function transforming the current cell value. @return the aggregated measure. @see cern.jet.math.Functions */ public double aggregate(cern.colt.function.DoubleDoubleFunction aggr, cern.colt.function.DoubleFunction f) { if (size==0) return Double.NaN; double a = f.apply(getQuick(size-1)); for (int i=size-1; --i >= 0; ) { a = aggr.apply(a, f.apply(getQuick(i))); } return a; } /**
/** Applies a function to each cell and aggregates the results. Returns a value <tt>v</tt> such that <tt>v==a(size())</tt> where <tt>a(i) == aggr( a(i-1), f(get(i)) )</tt> and terminators are <tt>a(1) == f(get(0)), a(0)==Double.NaN</tt>. <p> <b>Example:</b> <pre> cern.jet.math.Functions F = cern.jet.math.Functions.functions; matrix = 0 1 2 3 // Sum( x[i]*x[i] ) matrix.aggregate(F.plus,F.square); --> 14 </pre> For further examples, see the <a href="package-summary.html#FunctionObjects">package doc</a>. @param aggr an aggregation function taking as first argument the current aggregation and as second argument the transformed current cell value. @param f a function transforming the current cell value. @return the aggregated measure. @see cern.jet.math.Functions */ public double aggregate(cern.colt.function.DoubleDoubleFunction aggr, cern.colt.function.DoubleFunction f) { if (size==0) return Double.NaN; double a = f.apply(getQuick(size-1)); for (int i=size-1; --i >= 0; ) { a = aggr.apply(a, f.apply(getQuick(i))); } return a; } /**
/** Assigns the result of a function to each cell; <tt>x[i] = function(x[i],y[i])</tt>. <p> <b>Example:</b> <pre> // assign x[i] = x[i]<sup>y[i]</sup> m1 = 0 1 2 3; m2 = 0 2 4 6; m1.assign(m2, cern.jet.math.Functions.pow); --> m1 == 1 1 16 729 </pre> For further examples, see the <a href="package-summary.html#FunctionObjects">package doc</a>. @param y the secondary matrix to operate on. @param function a function object taking as first argument the current cell's value of <tt>this</tt>, and as second argument the current cell's value of <tt>y</tt>, @return <tt>this</tt> (for convenience only). @throws IllegalArgumentException if <tt>size() != y.size()</tt>. @see cern.jet.math.Functions */ public DoubleMatrix1D assign(DoubleMatrix1D y, cern.colt.function.DoubleDoubleFunction function) { checkSize(y); for (int i=size; --i >= 0; ) { setQuick(i, function.apply(getQuick(i), y.getQuick(i))); } return this; } /**
for (int row=rows; --row >= 0; ) { for (int column=columns-d; --column >= 0; ) { a = aggr.apply(a, f.apply(getQuick(row,column)));
for (int row=rows; --row >= 0; ) { for (int column=columns-d; --column >= 0; ) { a = aggr.apply(a, f.apply(getQuick(row,column)));
for (int row=rows; --row >= 0; ) { for (int column=columns-d; --column >= 0; ) { a = aggr.apply(a, f.apply(getQuick(slice,row,column)));