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
Currently, there is no way to use std::iter::Sum with an iterator over matrices (or vectors). I believe the reason for this is that #264 implements the trait in terms of DimName and not the more general Dim type.
This makes a lot of sense because then the dimensions of the resulting matrix are known in advance. For dynamic matrices, we would have to check (or make the assumption) that all elements have the correct dimensions. A straightforward approach would be to have the first element determine the size of the allocation. The problem with this approach is that there might not be a first element (the sequence is empty):
let mut it = seq.iter();
let x = it.next().unwrap().clone();
let res = it.fold(x, |acc, v| acc + v);
Do you see a way to make std::iter::Sum work with the dynamic types?
The text was updated successfully, but these errors were encountered:
Currently, there is no way to use
std::iter::Sum
with an iterator over matrices (or vectors). I believe the reason for this is that #264 implements the trait in terms ofDimName
and not the more generalDim
type.This makes a lot of sense because then the dimensions of the resulting matrix are known in advance. For dynamic matrices, we would have to check (or make the assumption) that all elements have the correct dimensions. A straightforward approach would be to have the first element determine the size of the allocation. The problem with this approach is that there might not be a first element (the sequence is empty):
Do you see a way to make
std::iter::Sum
work with the dynamic types?The text was updated successfully, but these errors were encountered: