saf2d

Macro saf2d 

Source
macro_rules! saf2d {
    ($([$($x:literal),+ $(,)?; $($y:literal),+ $(,)?]),+ $(,)?) => { ... };
}
Expand description

Creates a joint SAF matrix of two populations.

This is mainly intended for readability in doc-tests.

ยงExamples

use winsfs_core::saf2d;
let saf = saf2d![
    [0.0,  0.1,  0.2  ; 1.0, 1.1],
    [0.3,  0.4,  0.5  ; 1.2, 1.3],
    [0.6,  0.7,  0.8  ; 1.4, 1.5],
    [0.9,  0.10, 0.11 ; 1.6, 1.7],
    [0.12, 0.13, 0.14 ; 1.8, 1.9],
];
assert_eq!(saf.sites(), 5);
assert_eq!(saf.shape(), [3, 2]);
assert_eq!(saf.get_site(0).as_slice(), &[0.0, 0.1, 0.2, 1.0, 1.1]);
assert_eq!(saf.get_site(2).as_slice(), &[0.6, 0.7, 0.8, 1.4, 1.5]);