extendr_api::prelude

Macro concatenate

Source
macro_rules! concatenate {
    ($axis:expr, $( $array:expr ),+ ,) => { ... };
    ($axis:expr, $( $array:expr ),+ ) => { ... };
}
Expand description

Concatenate arrays along the given axis.

Uses the concatenate() function, calling ArrayView::from(&a) on each argument a.

Panics if the concatenate function would return an error.

extern crate ndarray;

use ndarray::{arr2, concatenate, Axis};


let a = arr2(&[[1., 2.],
               [3., 4.]]);
assert_eq!(
    concatenate![Axis(0), a, a],
    arr2(&[[1., 2.],
           [3., 4.],
           [1., 2.],
           [3., 4.]]),
);
assert_eq!(
    concatenate![Axis(1), a, a,],
    arr2(&[[1., 2., 1., 2.],
           [3., 4., 3., 4.]]),
);