vector_norm_parallel

Function vector_norm_parallel 

Source
pub fn vector_norm_parallel<F>(
    x: &ArrayView1<'_, F>,
    ord: usize,
    workers: Option<usize>,
) -> LinalgResult<F>
Expand description

Compute the norm of a vector with parallel processing support.

This function uses parallel computation to calculate vector norms efficiently for large vectors. The computation is distributed across multiple worker threads using the scirs2-core parallel operations framework.

§Arguments

  • x - Input vector
  • ord - Norm order (1, 2, or usize::MAX for infinity norm)
  • workers - Number of worker threads (None = use default)

§Returns

  • Norm of the vector

§Examples

use scirs2_core::ndarray::{array, ScalarOperand};
use scirs2_linalg::vector_norm_parallel;

let x = array![3.0_f64, 4.0];
let norm2 = vector_norm_parallel(&x.view(), 2, Some(4)).unwrap();
assert!((norm2 - 5.0).abs() < 1e-10);