So I need to compute the exponential function, where the exponent is a Matrix. Since I am using the ndarray crate, and didn’t find an implementation for, e.g., exp(H), where H is the matrix.
I stumbled upon the expm crate.
However I wasn’t able to get it to work. I always get the error:
arguments to this function are incorrect
ArrayBase<OwnedRepr<_>, Dim<...>>
andArrayBase<_, Dim<[usize; 2]>>
have similar names, but are actually distinct types
perhaps two different versions of cratendarray
are being used?
ArrayBase<OwnedRepr<f64>, Dim<...>>
andArrayBase<_, Dim<[usize; 2]>>
have similar names, but are actually distinct types
perhaps two different versions of cratendarray
are being used?
My code:
use ndarray::*;
use ndarray_rand::rand_distr::num_traits::Pow;
extern crate openblas_src;
fn main() {
let d: usize = 3;
let eye: AArrayBase<ndarray::OwnedRepr<f64>, Dim<[usize; 2]>> = Array::eye(d);
let mut b: ArrayBase<ndarray::OwnedRepr<f64>, Dim<[usize; 2]>> = Array::eye(d);
expm::expm(&eye, &mut b);
}
I am on a windows system and use vscode for development. I installed/compiled openblas-src, following the crate discription.
I followed the example on expm the crate page. Yet it doesn’t work. Since I am fairly new to rust, my inexperience could be the cause of it.
What am I doing wrong here?
Might there be a better crate (that has more recent updates than expm) to get this functionality ?
1