mikera.vectorz.ops.SoftPlus Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vectorz Show documentation
Show all versions of vectorz Show documentation
Fast double-precision vector and matrix maths library for Java, supporting N-dimensional numeric arrays.
package mikera.vectorz.ops;
import java.io.ObjectStreamException;
import mikera.vectorz.Op;
public final class SoftPlus extends ABoundedOp {
public static final SoftPlus INSTANCE=new SoftPlus();
private static double softplus (double x) {
if (x>100) return x;
if (x<-100) return 0.0;
return Math.log(1.0+Math.exp(x));
}
private static double inverseSoftplus (double y) {
return Math.log(Math.exp(y)-1.0);
}
@Override
public double apply(double x) {
return softplus(x);
}
@Override
public double applyInverse(double y) {
return inverseSoftplus(y);
}
@Override
public void applyTo(double[] data, int start,int length) {
for (int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy