Is there an easy and optimal way to combine a
and b
to get c
? I am struggling with this since I can't use index for c
because it's not initialized. I am trying to avoid initializing c
using 2 vectors of zeroes.
let mut a: Vec<Vec<f64>> = Vec::with_capacity(2);
a.push(vec![1., 2., 3.]);
a.push(vec![4., 5., 6.]);
let mut b: Vec<Vec<f64>> = Vec::with_capacity(2);
b.push(vec![7., 8., 9.]);
b.push(vec![10., 11., 12.]);
let mut c: Vec<Vec<f64>> = Vec::with_capacity(2);
// expected result:
// c: Vec<Vec<f64>> = [[1., 2., 3., 7., 8., 9.], [4., 5., 6., 10., 11., 12.] ]