matrix_exp

Function matrix_exp 

pub fn matrix_exp<T, C>(
    ctx: &mut C,
    tensor: &Tensor<T>,
) -> Result<Tensor<T>, Error>
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]);