Java Code Examples for org.apache.commons.math3.util.FastMath#sinh()
The following examples show how to use
org.apache.commons.math3.util.FastMath#sinh() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Compute hyperbolic sine of a derivative structure. * @param operand array holding the operand * @param operandOffset offset of the operand in its array * @param result array where result must be stored (for * hyperbolic sine the result array <em>cannot</em> be the input * array) * @param resultOffset offset of the result in its array */ public void sinh(final double[] operand, final int operandOffset, final double[] result, final int resultOffset) { // create the function value and derivatives double[] function = new double[1 + order]; function[0] = FastMath.sinh(operand[operandOffset]); if (order > 0) { function[1] = FastMath.cosh(operand[operandOffset]); for (int i = 2; i <= order; ++i) { function[i] = function[i - 2]; } } // apply function composition compose(operand, operandOffset, function, result, resultOffset); }
Example 2
Source File: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Compute hyperbolic cosine of a derivative structure. * @param operand array holding the operand * @param operandOffset offset of the operand in its array * @param result array where result must be stored (for * hyperbolic cosine the result array <em>cannot</em> be the input * array) * @param resultOffset offset of the result in its array */ public void cosh(final double[] operand, final int operandOffset, final double[] result, final int resultOffset) { // create the function value and derivatives double[] function = new double[1 + order]; function[0] = FastMath.cosh(operand[operandOffset]); if (order > 0) { function[1] = FastMath.sinh(operand[operandOffset]); for (int i = 2; i <= order; ++i) { function[i] = function[i - 2]; } } // apply function composition compose(operand, operandOffset, function, result, resultOffset); }
Example 3
Source File: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Compute hyperbolic cosine of a derivative structure. * @param operand array holding the operand * @param operandOffset offset of the operand in its array * @param result array where result must be stored (for * hyperbolic cosine the result array <em>cannot</em> be the input * array) * @param resultOffset offset of the result in its array */ public void cosh(final double[] operand, final int operandOffset, final double[] result, final int resultOffset) { // create the function value and derivatives double[] function = new double[1 + order]; function[0] = FastMath.cosh(operand[operandOffset]); if (order > 0) { function[1] = FastMath.sinh(operand[operandOffset]); for (int i = 2; i <= order; ++i) { function[i] = function[i - 2]; } } // apply function composition compose(operand, operandOffset, function, result, resultOffset); }
Example 4
Source File: Math_10_DSCompiler_t.java From coming with MIT License | 6 votes |
/** Compute hyperbolic cosine of a derivative structure. * @param operand array holding the operand * @param operandOffset offset of the operand in its array * @param result array where result must be stored (for * hyperbolic cosine the result array <em>cannot</em> be the input * array) * @param resultOffset offset of the result in its array */ public void cosh(final double[] operand, final int operandOffset, final double[] result, final int resultOffset) { // create the function value and derivatives double[] function = new double[1 + order]; function[0] = FastMath.cosh(operand[operandOffset]); if (order > 0) { function[1] = FastMath.sinh(operand[operandOffset]); for (int i = 2; i <= order; ++i) { function[i] = function[i - 2]; } } // apply function composition compose(operand, operandOffset, function, result, resultOffset); }
Example 5
Source File: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Compute hyperbolic sine of a derivative structure. * @param operand array holding the operand * @param operandOffset offset of the operand in its array * @param result array where result must be stored (for * hyperbolic sine the result array <em>cannot</em> be the input * array) * @param resultOffset offset of the result in its array */ public void sinh(final double[] operand, final int operandOffset, final double[] result, final int resultOffset) { // create the function value and derivatives double[] function = new double[1 + order]; function[0] = FastMath.sinh(operand[operandOffset]); if (order > 0) { function[1] = FastMath.cosh(operand[operandOffset]); for (int i = 2; i <= order; ++i) { function[i] = function[i - 2]; } } // apply function composition compose(operand, operandOffset, function, result, resultOffset); }
Example 6
Source File: Math_10_DSCompiler_s.java From coming with MIT License | 6 votes |
/** Compute hyperbolic sine of a derivative structure. * @param operand array holding the operand * @param operandOffset offset of the operand in its array * @param result array where result must be stored (for * hyperbolic sine the result array <em>cannot</em> be the input * array) * @param resultOffset offset of the result in its array */ public void sinh(final double[] operand, final int operandOffset, final double[] result, final int resultOffset) { // create the function value and derivatives double[] function = new double[1 + order]; function[0] = FastMath.sinh(operand[operandOffset]); if (order > 0) { function[1] = FastMath.cosh(operand[operandOffset]); for (int i = 2; i <= order; ++i) { function[i] = function[i - 2]; } } // apply function composition compose(operand, operandOffset, function, result, resultOffset); }
Example 7
Source File: DSCompiler.java From astor with GNU General Public License v2.0 | 6 votes |
/** Compute hyperbolic cosine of a derivative structure. * @param operand array holding the operand * @param operandOffset offset of the operand in its array * @param result array where result must be stored (for * hyperbolic cosine the result array <em>cannot</em> be the input * array) * @param resultOffset offset of the result in its array */ public void cosh(final double[] operand, final int operandOffset, final double[] result, final int resultOffset) { // create the function value and derivatives double[] function = new double[1 + order]; function[0] = FastMath.cosh(operand[operandOffset]); if (order > 0) { function[1] = FastMath.sinh(operand[operandOffset]); for (int i = 2; i <= order; ++i) { function[i] = function[i - 2]; } } // apply function composition compose(operand, operandOffset, function, result, resultOffset); }
Example 8
Source File: Sinh.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public double value(double x) { return FastMath.sinh(x); }
Example 9
Source File: Builtin.java From systemds with Apache License 2.0 | 4 votes |
@Override public double execute (double in) { switch(bFunc) { case SIN: return FASTMATH ? FastMath.sin(in) : Math.sin(in); case COS: return FASTMATH ? FastMath.cos(in) : Math.cos(in); case TAN: return FASTMATH ? FastMath.tan(in) : Math.tan(in); case ASIN: return FASTMATH ? FastMath.asin(in) : Math.asin(in); case ACOS: return FASTMATH ? FastMath.acos(in) : Math.acos(in); case ATAN: return Math.atan(in); //faster in Math // FastMath.*h is faster 98% of time than Math.*h in initial micro-benchmarks case SINH: return FASTMATH ? FastMath.sinh(in) : Math.sinh(in); case COSH: return FASTMATH ? FastMath.cosh(in) : Math.cosh(in); case TANH: return FASTMATH ? FastMath.tanh(in) : Math.tanh(in); case CEIL: return FASTMATH ? FastMath.ceil(in) : Math.ceil(in); case FLOOR: return FASTMATH ? FastMath.floor(in) : Math.floor(in); case LOG: return Math.log(in); //faster in Math case LOG_NZ: return (in==0) ? 0 : Math.log(in); //faster in Math case ABS: return Math.abs(in); //no need for FastMath case SIGN: return FASTMATH ? FastMath.signum(in) : Math.signum(in); case SQRT: return Math.sqrt(in); //faster in Math case EXP: return FASTMATH ? FastMath.exp(in) : Math.exp(in); case ROUND: return Math.round(in); //no need for FastMath case PLOGP: if (in == 0.0) return 0.0; else if (in < 0) return Double.NaN; else //faster in Math return in * Math.log(in); case SPROP: //sample proportion: P*(1-P) return in * (1 - in); case SIGMOID: //sigmoid: 1/(1+exp(-x)) return FASTMATH ? 1 / (1 + FastMath.exp(-in)) : 1 / (1 + Math.exp(-in)); case ISNA: return Double.isNaN(in) ? 1 : 0; case ISNAN: return Double.isNaN(in) ? 1 : 0; case ISINF: return Double.isInfinite(in) ? 1 : 0; default: throw new DMLRuntimeException("Builtin.execute(): Unknown operation: " + bFunc); } }
Example 10
Source File: SparseGradient.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public SparseGradient sinh() { return new SparseGradient(FastMath.sinh(value), FastMath.cosh(value), derivatives); }
Example 11
Source File: Sinh.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public double value(double x) { return FastMath.sinh(x); }
Example 12
Source File: Sinh.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public double value(double x) { return FastMath.sinh(x); }
Example 13
Source File: LibSpoofPrimitives.java From systemds with Apache License 2.0 | 4 votes |
public static double[] vectSinhWrite(double[] a, int ai, int len) { double[] c = allocVector(len, false); for( int j = 0; j < len; j++, ai++) c[j] = FastMath.sinh(a[ai]); return c; }
Example 14
Source File: LibSpoofPrimitives.java From systemds with Apache License 2.0 | 4 votes |
public static void vectSinhAdd(double[] a, double[] c, int[] aix, int ai, int ci, int alen, int len) { for( int j = ai; j < ai+alen; j++ ) c[ci + aix[j]] += FastMath.sinh(a[j]); }
Example 15
Source File: LibSpoofPrimitives.java From systemds with Apache License 2.0 | 4 votes |
public static void vectSinhAdd(double[] a, double[] c, int ai, int ci, int len) { for( int j = ai; j < ai+len; j++, ci++) c[ci] += FastMath.sinh(a[j]); }
Example 16
Source File: Builtin.java From systemds with Apache License 2.0 | 4 votes |
@Override public double execute (double in) { switch(bFunc) { case SIN: return FASTMATH ? FastMath.sin(in) : Math.sin(in); case COS: return FASTMATH ? FastMath.cos(in) : Math.cos(in); case TAN: return FASTMATH ? FastMath.tan(in) : Math.tan(in); case ASIN: return FASTMATH ? FastMath.asin(in) : Math.asin(in); case ACOS: return FASTMATH ? FastMath.acos(in) : Math.acos(in); case ATAN: return Math.atan(in); //faster in Math // FastMath.*h is faster 98% of time than Math.*h in initial micro-benchmarks case SINH: return FASTMATH ? FastMath.sinh(in) : Math.sinh(in); case COSH: return FASTMATH ? FastMath.cosh(in) : Math.cosh(in); case TANH: return FASTMATH ? FastMath.tanh(in) : Math.tanh(in); case CEIL: return FASTMATH ? FastMath.ceil(in) : Math.ceil(in); case FLOOR: return FASTMATH ? FastMath.floor(in) : Math.floor(in); case LOG: return Math.log(in); //faster in Math case LOG_NZ: return (in==0) ? 0 : Math.log(in); //faster in Math case ABS: return Math.abs(in); //no need for FastMath case SIGN: return FASTMATH ? FastMath.signum(in) : Math.signum(in); case SQRT: return Math.sqrt(in); //faster in Math case EXP: return FASTMATH ? FastMath.exp(in) : Math.exp(in); case ROUND: return Math.round(in); //no need for FastMath case PLOGP: if (in == 0.0) return 0.0; else if (in < 0) return Double.NaN; else //faster in Math return in * Math.log(in); case SPROP: //sample proportion: P*(1-P) return in * (1 - in); case SIGMOID: //sigmoid: 1/(1+exp(-x)) return FASTMATH ? 1 / (1 + FastMath.exp(-in)) : 1 / (1 + Math.exp(-in)); case ISNA: return Double.isNaN(in) ? 1 : 0; case ISNAN: return Double.isNaN(in) ? 1 : 0; case ISINF: return Double.isInfinite(in) ? 1 : 0; default: throw new DMLRuntimeException("Builtin.execute(): Unknown operation: " + bFunc); } }
Example 17
Source File: Sinh.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public double value(double x) { return FastMath.sinh(x); }
Example 18
Source File: Sinh.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public double value(double x) { return FastMath.sinh(x); }
Example 19
Source File: LibSpoofPrimitives.java From systemds with Apache License 2.0 | 4 votes |
public static double[] vectSinhWrite(double[] a, int ai, int len) { double[] c = allocVector(len, false); for( int j = 0; j < len; j++, ai++) c[j] = FastMath.sinh(a[ai]); return c; }
Example 20
Source File: LibSpoofPrimitives.java From systemds with Apache License 2.0 | 4 votes |
public static void vectSinhAdd(double[] a, double[] c, int[] aix, int ai, int ci, int alen, int len) { for( int j = ai; j < ai+alen; j++ ) c[ci + aix[j]] += FastMath.sinh(a[j]); }