Skip to main content

vstack

Function vstack 

Source
pub fn vstack<T>(arrays: &[ArrayView2<'_, T>]) -> CoreResult<Array2<T>>
where T: Clone + Zero,
Expand description

Stack a sequence of 2D arrays vertically (concatenate rows).

All arrays must have the same number of columns. Returns an error if the slice is empty or if any column-count mismatches exist.

ยงExamples

use scirs2_core::ops::vstack;
use ndarray::array;

let a = array![[1.0_f64, 2.0], [3.0, 4.0]];
let b = array![[5.0_f64, 6.0]];
let s = vstack(&[a.view(), b.view()]).expect("same column count");
assert_eq!(s.shape(), &[3, 2]);
assert_eq!(s[[2, 0]], 5.0);