pub fn det<T, C>(ctx: &mut C, tensor: &Tensor<T>) -> Result<Tensor<T>>where
C: TensorLinalgContextFor<T> + TensorScalarContextFor<Standard<T>> + TensorScalarContextFor<Standard<T::Real>> + TensorMetadataContextFor,
T: ScaleTensorByRealSameShape<C> + KernelLinalgScalar,
T::Real: Scalar + NumCast + One + 'static,
C::MetadataBackend: TensorMetadataPrims<Context = C>,
<C as TensorScalarContextFor<Standard<T::Real>>>::ScalarBackend: TensorMetadataCastPrims<T::Real, Context = C>,
C::Backend: 'static,Expand description
Compute the determinant of a square matrix.
ยงExamples
use tenferro_linalg::det;
use tenferro_prims::CpuContext;
use tenferro_tensor::{MemoryOrder, Tensor};
let mut ctx = CpuContext::new(1);
let col = MemoryOrder::ColumnMajor;
let a = Tensor::<f64>::from_slice(&[1.0, 0.0, 0.0, 2.0], &[2, 2], col).unwrap();
let d = det(&mut ctx, &a).unwrap();
assert_eq!(d.ndim(), 0);