Pub use of exp in the linalg module

This commit is contained in:
Fredrik Jansson 2020-04-03 11:11:14 +02:00
parent b3ef66fd14
commit 4ec94408b5
2 changed files with 5 additions and 2 deletions

View File

@ -1,3 +1,5 @@
//! This module provides the matrix exponent (exp) function to square matrices.
//!
use crate::{ use crate::{
base::{ base::{
allocator::Allocator, allocator::Allocator,
@ -403,14 +405,14 @@ where
DefaultAllocator: DefaultAllocator:
Allocator<N, R, R> + Allocator<(usize, usize), DimMinimum<R, R>> + Allocator<N, R>, Allocator<N, R, R> + Allocator<(usize, usize), DimMinimum<R, R>> + Allocator<N, R>,
{ {
/// Computes exp of this matrix /// Computes exponential of this matrix
pub fn exp(&self) -> Self { pub fn exp(&self) -> Self {
// Simple case // Simple case
if self.nrows() == 1 { if self.nrows() == 1 {
return self.clone().map(|v| v.exp()); return self.clone().map(|v| v.exp());
} }
let mut h = ExpmPadeHelper::new(self.clone(), false); let mut h = ExpmPadeHelper::new(self.clone(), true);
let eta_1 = N::max(h.d4_loose(), h.d6_loose()); let eta_1 = N::max(h.d4_loose(), h.d6_loose());
if eta_1 < N::from_f64(1.495585217958292e-002).unwrap() && ell(&h.a, 3) == 0 { if eta_1 < N::from_f64(1.495585217958292e-002).unwrap() && ell(&h.a, 3) == 0 {

View File

@ -27,6 +27,7 @@ mod symmetric_tridiagonal;
pub use self::bidiagonal::*; pub use self::bidiagonal::*;
pub use self::cholesky::*; pub use self::cholesky::*;
pub use self::convolution::*; pub use self::convolution::*;
pub use self::exp::*;
pub use self::full_piv_lu::*; pub use self::full_piv_lu::*;
pub use self::hessenberg::*; pub use self::hessenberg::*;
pub use self::lu::*; pub use self::lu::*;