Skip to main content

det

Function det 

Source
pub fn det<B: Backend, T: LinalgFloat>(a: &Array<B, T>) -> Array<B, T>
Expand description

The determinant of each square matrix, as jnp.linalg.det: the sign times the exponential of the log-determinant from slogdet (JAX uses closed forms for 2 x 2 and 3 x 3 matrices, which round differently).

§Panics

Panics if a is not a batch of square matrices.

§Examples

use ruxla_core::{Array, Native, jnp};

let a = Array::<Native, f64>::from_vec(vec![1.0, 2.0, 3.0, 4.0], [2, 2]);
assert!((jnp::linalg::det(&a).to_vec()[0] + 2.0).abs() < 1e-12);