HyperGP.tensor.loge#
- loge(x)[source]#
Perform the natural logarithm of an array, elementwise.
The natural logarithm is logarithm in base e, so that log(exp(x)) = x
- Parameters:
x (Tensor or array_like) – Elements to perform the natural logarithm.
- Returns:
the natural logarithm 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.log(x1) for i in range(10)] >>> print("numpy runtime: ", time.time() - st)
>>> st = time.time() >>> ar = [HyperGP.log(x1_t) for i in range(10)] >>> print("HyperGP runtime: ", time.time() - st)