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

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

Introduction

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

Prototype

public static double acos(double x) 

Source Link

Document

Compute the arc cosine of a number.

Usage

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

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

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

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