Skip to main content

norm

Function norm 

Source
pub fn norm<B: Backend, T: LinalgFloat>(
    x: &Array<B, T>,
    ord: NormOrd,
    axes: NormAxes,
    keepdims: bool,
) -> Array<B, T>
Expand description

A norm of vectors or matrices, as jnp.linalg.norm.

§Panics

Panics if the axes are out of range, or if ord is not a norm of the kind the axes select.

§Examples

use ruxla_core::{Array, Native, jnp};
use ruxla_core::jnp::linalg::{NormAxes, NormOrd};

let x = Array::<Native, f64>::from_vec(vec![3.0, -4.0], [2]);
assert_eq!(jnp::linalg::norm(&x, NormOrd::Default, NormAxes::All, false).to_vec(), [5.0]);
assert_eq!(jnp::linalg::norm(&x, NormOrd::Inf, NormAxes::All, false).to_vec(), [4.0]);