pow

Contents

pow#

class saiunit.lax.pow(x, y, **kwargs)#

Elementwise power: \(x^y\).

Parameters:
  • x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – The base.

  • y (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – The exponent. Must be unitless if x has a unit.

Returns:

result – The result of x ** y. If x has unit u, the result has unit u ** y.

Return type:

saiunit.Quantity | Array

Raises:

TypeError – If y has a non-trivial unit.

Examples

>>> import saiunit as u
>>> import saiunit.lax as sulax
>>> import jax.numpy as jnp
>>> q = jnp.array([2.0, 3.0]) * u.meter
>>> result = sulax.pow(q, jnp.float32(2.0))
>>> result.mantissa
Array([4., 9.], dtype=float32)