pub fn matrix_exp<T, C>(ctx: &mut C, tensor: &Tensor<T>) -> Result<Tensor<T>>where
T: KernelLinalgScalar + ScaleTensorByRealSameShape<C> + MatrixExpAbsTensor<C>,
T::Real: KernelLinalgScalar<Real = T::Real> + Float,
C: TensorLinalgContextFor<T> + TensorScalarContextFor<Standard<T>> + TensorScalarContextFor<Standard<T::Real>> + TensorSemiringContextFor<Standard<T>>,
<C as TensorScalarContextFor<Standard<T::Real>>>::ScalarBackend: TensorAnalyticPrims<Standard<T::Real>, Context = C>,
C::Backend: 'static,Expand description
Compute the matrix exponential exp(A) of a square matrix.
ยงExamples
use tenferro_device::LogicalMemorySpace;
use tenferro_linalg::matrix_exp;
use tenferro_prims::CpuContext;
use tenferro_tensor::{MemoryOrder, Tensor};
let mut ctx = CpuContext::new(1);
let col = MemoryOrder::ColumnMajor;
let mem = LogicalMemorySpace::MainMemory;
let a = Tensor::<f64>::zeros(&[3, 3], mem, col).unwrap();
let result = matrix_exp(&mut ctx, &a).unwrap();
assert_eq!(result.dims(), &[3, 3]);