It would be convenient to be able to call concatenate or stack with a slice of owned arrays or array views, rather than just views currently.
So for concatenate, this:
let arrays = vec![a, b, c]; // more realistically, this would be returned by a function
let arrays = arrays.iter().map(|a| a.view()).collect::<Vec<_>>();
let res = ndarray::concatenate(Axis(2), &arrays);
would become:
let arrays = vec![a, b, c];
let res = ndarray::concatenate(Axis(2), &arrays);
This could be done by changing the signature of concatenate to the following, which would allow either views or owned arrays:
-pub fn concatenate<A, D>(axis: Axis, arrays: &[ArrayView<A, D>]) -> Result<Array<A, D>, ShapeError>
+pub fn concatenate<S, D, A>(axis: Axis, arrays: &[ArrayBase<S, D, A>]) -> Result<Array<A, D>, ShapeError>
where
+ S: Data<Elem = A>,
A: Clone,
D: RemoveAxis,
{
This is technically a breaking API change though, at least in the niche case of passing an empty slice as a parameter (which causes a type inference error). Before I open an unsolicited PR, would there be interest in this change?
It would be convenient to be able to call
concatenateorstackwith a slice of owned arrays or array views, rather than just views currently.So for
concatenate, this:would become:
This could be done by changing the signature of
concatenateto the following, which would allow either views or owned arrays:This is technically a breaking API change though, at least in the niche case of passing an empty slice as a parameter (which causes a type inference error). Before I open an unsolicited PR, would there be interest in this change?