You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let a = array![[9.,7.],[5.,2.]];let b = array![[1.,9.],[5.,1.]];println!("a vstack b = \n{:?}\n", stack![Axis(0), a, b]);println!("a hstack b = \n{:?}\n", stack![Axis(1), a, b]);
should be
a vstack b =
[[9.0,7.0],[5.0,2.0],[1.0,9.0],[5.0,1.0]], shape=[4,2], strides=[2,1], layout=C(0x1),const ndim=2
a hstack b =
[[9.0,7.0,1.0,9.0],[5.0,2.0,5.0,1.0]], shape=[2,4], strides=[4,1], layout=C(0x1),const ndim=2
but it returns
a vstack b =
[[[9.0,7.0],[5.0,2.0]],[[1.0,9.0],[5.0,1.0]]], shape=[2,2,2], strides=[4,2,1], layout=Cc(0x5),const ndim=3
a hstack b =
[[[9.0,7.0],[1.0,9.0]],[[5.0,2.0],[5.0,1.0]]], shape=[2,2,2], strides=[2,4,1], layout=c(0x4),const ndim=3
The concatenate! macro does what you're looking for. (Playground) concatenate! concatenates arrays along an existing axis; stack! stacks arrays along a new axis.
Activity
jturner314 commentedon Feb 16, 2022
The
concatenate!macro does what you're looking for. (Playground)concatenate!concatenates arrays along an existing axis;stack!stacks arrays along a new axis.HyeokSuLee commentedon Feb 16, 2022
Great. But then, i think quick start tutorial need to be fixed.
https://github.com/rust-ndarray/ndarray/blob/master/README-quick-start.md
jturner314 commentedon Feb 17, 2022
Oh, good catch. Thanks! I've created #1156 to fix the quick start tutorial.