APISonar


org.apache.commons.math3.util.FastMath.log

> org > apache > commons > math3 > util > FastMath > log
org APIs apache APIs commons APIs math3 APIs util APIs FastMath APIs log APIs

Example 1
public Double calculate(TokenCounts tokenCounts) {
        double ent = 0.0d;
        double p = 0.0d;
        double base = 2.0;
        double totalTokens = (double)tokenCounts.getTotalTokens();
        for (MutableInt i : tokenCounts.getTokens().values()) {
            int termFreq = i.intValue();

            p = (double) termFreq / totalTokens;
            ent += p * FastMath.log(base, p);
        }
        return -1.0*ent;
    }
Example 2
public Pair<Double, INDArray> hBeta(INDArray d, double beta) {
        INDArray P = exp(d.neg().muli(beta));
        double sumP = P.sumNumber().doubleValue();
        double logSumP = FastMath.log(sumP);
        Double H = logSumP + ((beta * (d.mul(P).sumNumber().doubleValue())) / sumP);
        P.divi(sumP);
        return new Pair<>(H, P);
    }
Example 3
public IComplexNumber log() {
        IComplexNumber result = dup();
        double real = (double) result.realComponent();
        double imaginary = (double) result.imaginaryComponent();
        double modulus = FastMath.sqrt(real * real + imaginary * imaginary);
        double arg = FastMath.atan2(imaginary, real);
        return result.set(FastMath.log(modulus), arg);
    }
Example 4
private static double calculateHomozygousLogRatio(final AllelicCount allelicCount,
                                                      final double genotypingBaseErrorRate) {
        final int r = allelicCount.getRefReadCount();
        final int n = allelicCount.getTotalReadCount();
        final double betaAll = Beta.regularizedBeta(1, r + 1, n - r + 1);
        final double betaError = Beta.regularizedBeta(genotypingBaseErrorRate, r + 1, n - r + 1);
        final double betaOneMinusError = Beta.regularizedBeta(1 - genotypingBaseErrorRate, r + 1, n - r + 1);
        final double betaHom = betaError + betaAll - betaOneMinusError;
        final double betaHet = betaOneMinusError - betaError;
        return FastMath.log(betaHom) - FastMath.log(betaHet);
    }
Example 5
private static double wsigmoid( final double wij, MatrixBlock u, MatrixBlock v, final int uix, final int vix, final boolean flagminus, final boolean flaglog, final int len )
	{
		//compute dot product over ui vj 
		double uvij = dotProductGeneric(u, v, uix, vix, len);
		
		//compute core sigmoid function  
		double cval = flagminus ?
				1 / (1 + FastMath.exp(uvij)) :
				1 / (1 + FastMath.exp(-uvij));
				
		//compute weighted output
		return wij * ((flaglog) ? FastMath.log(cval) : cval);
	}