Example usage for org.apache.commons.math4.util FastMath log

List of usage examples for org.apache.commons.math4.util FastMath log

Introduction

In this page you can find the example usage for org.apache.commons.math4.util FastMath log.

Prototype

public static double log(final double x) 

Source Link

Document

Natural logarithm.

Usage

From source file:com.ericbarnhill.arrayMath.ArrayMath.java

/**
  * In-place element-wise {@code log} of a {@code double[]}. Returns reference to first passed array.
  */* www.  ja  va2  s . co m*/
  * @param f {@code double[]} array.
  * @return  {@code double[]} array.
  * 
  * @since 0.1
  */
public static double[] log(double[] f) {
    final int fi = f.length;
    for (int i = 0; i < fi; i++) {
        f[i] = FastMath.log(f[i]);
    }
    return f;
}

From source file:com.ericbarnhill.arrayMath.ArrayMath.java

/**
  * Element-wise {@code log} of a {@code double[]}. Returns deep copy.
  *//from   w w w.  j  av  a  2 s  . c  o m
  * @param f {@code double[]} array.
  * @return  {@code double[]} array.
  * 
  * @since 0.1
  */
public static double[] logC(double[] f) {
    final int fi = f.length;
    double[] h = new double[fi];
    for (int i = 0; i < fi; i++) {
        h[i] = FastMath.log(f[i]);
    }
    return h;
}