macro_rules! check_positive_arrayd {
    ($($s:ident.$x:ident),*) => { ... };
    ($($x:expr),*) => { ... };
}
Expand description

Macro to check that each Array has only positive non-zero elements.

Examples

use color_eyre::{Result, eyre::ensure};
use corries::check_positive_arrayd;
use ndarray::Array1;

fn get_ones() -> Result<()> {
    check_positive_arrayd!(Array1::<f64>::ones(5));
    Ok(())
}
fn get_zeros() -> Result<()> {
    check_positive_arrayd!(Array1::<f64>::ones(2), Array1::<f64>::zeros(2));
    Ok(())
}

fn main() {
    let succeeds = get_ones();
    let errors = get_zeros();
    assert!(succeeds.is_ok());
    assert!(errors.is_err());
}