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
Ads help maintain this website.