HyperGP.tensor.arccos

Contents

HyperGP.tensor.arccos#

arccos(x)[source]#

Inverse cosine of an array, elementwise.

So that if y = cos(x) then x = arccos(y)

Parameters:

x (Tensor or array_like) – Elements to inverse cosine.

Returns:

the inverse cosine values of an array.

Return type:

ret(Tensor)

Examples

import modules

>>> import numpy as np
>>> from HyperGP import Tensor
>>> import time

array initialization

>>> x1 = np.random.uniform(-1, 1, size=(500, 100000))
>>> x1_t = Tensor(x1)

runtime test

>>> st = time.time()
>>> ar = [np.arccos(x1) for i in range(10)]
>>> print("numpy runtime: ", time.time() - st)
>>> st = time.time()
>>> ar = [HyperGP.arccos(x1_t) for i in range(10)]
>>> print("HyperGP runtime: ", time.time() - st)

Note

return nan if element not in [-1, 1]