List of usage examples for org.apache.commons.math4.util FastMath tanh
public static double tanh(double x)
From source file:com.ericbarnhill.arrayMath.ArrayMath.java
/** * In-place element-wise {@code tanh} of a {@code double[]}. Returns reference to first passed array. *//from www . j a v a 2 s. c o m * @param f {@code double[]} array. * @return {@code double[]} array. * * @since 0.1 */ public static double[] tanh(double[] f) { final int fi = f.length; for (int i = 0; i < fi; i++) { f[i] = FastMath.tanh(f[i]); } return f; }
From source file:com.ericbarnhill.arrayMath.ArrayMath.java
/** * Element-wise {@code tanh} of a {@code double[]}. Returns deep copy. *// w ww.j ava 2s.co m * @param f {@code double[]} array. * @return {@code double[]} array. * * @since 0.1 */ public static double[] tanhC(double[] f) { final int fi = f.length; double[] h = new double[fi]; for (int i = 0; i < fi; i++) { h[i] = FastMath.tanh(f[i]); } return h; }