logm_parallel

Function logm_parallel 

Source
pub fn logm_parallel<F>(
    a: &ArrayView2<'_, F>,
    workers: Option<usize>,
) -> LinalgResult<Array2<F>>
where F: Float + NumAssign + Sum + One + Send + Sync + ScalarOperand + 'static,
Expand description

Compute the matrix logarithm with parallel processing support.

This function computes log(A) for a square matrix A using the scaling and squaring method combined with Taylor series expansion. The computation is accelerated using parallel processing for matrix multiplications and element-wise operations.

§Arguments

  • a - Input square matrix
  • workers - Number of worker threads (None = use default)

§Returns

  • Matrix logarithm of the input

§Examples

use scirs2_core::ndarray::array;
use scirs2_linalg::matrix_functions::logm_parallel;

let a = array![[1.0_f64, 0.0], [0.0, 2.0]];
let log_a = logm_parallel(&a.view(), Some(4)).unwrap();
assert!((log_a[[0, 0]]).abs() < 1e-10);
assert!((log_a[[1, 1]] - 2.0_f64.ln()).abs() < 1e-10);