#![macro_use]
#[macro_export]
pub macro_rules! matrix(
(__count ) => { 0 };
(__count $_i:tt, $($rest:tt,)*) => { 1 + matrix!(__count $($rest,)*) };
($($($elt:expr),*);*) => {
{
let mut _first = true;
let mut rows: ::ndarray::Ix = 0;
let mut cols: ::ndarray::Ix = 0;
$(
{
let this_count = matrix!(__count $($elt,)*);
if !_first && this_count != cols {
panic!("Row length mismatch in matrix![]")
}
_first = false;
cols = this_count;
}
rows += 1;
)*
unsafe {
::ndarray::Array::from_vec_dim(
(rows, cols),
vec![
$(
$($elt,)*
)*
]
)
}
}
};
);