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

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

Introduction

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

Prototype

public static double sqrt(final double a) 

Source Link

Document

Compute the square root of a number.

Usage

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

/**
  * In-place element-wise {@code sqrt} of a {@code double[]}. Returns reference to first passed array.
  */*from   w  ww.  jav  a2 s.  c o  m*/
  * @param f {@code double[]} array.
  * @return  {@code double[]} array.
  * 
  * @since 0.1
  */
public static double[] sqrt(double[] f) {
    final int fi = f.length;
    for (int i = 0; i < fi; i++) {
        f[i] = FastMath.sqrt(f[i]);
    }
    return f;
}