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
use nalgebra::*;
use rayon::prelude::*;
let mut m = DMatrix::<f64>::from_vec(2, 3, (0..6).map(|n| n as f64).collect());
dbg!(&m);
m.column_iter_mut()
.par_bridge()
.for_each(|mut c| c[0] = 111.0);
dbg!(&m);
But the code doesn't compile:
no method named par_bridge found for struct ColumnIterMut<'_, f64, Dynamic, Dynamic, VecStorage<f64, Dynamic, Dynamic>> in the current scope
the method par_bridge exists but the following trait bounds were not satisfied: ColumnIterMut<'_, f64, Dynamic, Dynamic, VecStorage<f64, Dynamic, Dynamic>>: Send
which is required by ColumnIterMut<'_, f64, Dynamic, Dynamic, VecStorage<f64, Dynamic, Dynamic>>: rayon::iter::ParallelBridge &ColumnIterMut<'_, f64, Dynamic, Dynamic, VecStorage<f64, Dynamic, Dynamic>>: Send
which is required by &ColumnIterMut<'_, f64, Dynamic, Dynamic, VecStorage<f64, Dynamic, Dynamic>>: rayon::iter::ParallelBridge &ColumnIterMut<'_, f64, Dynamic, Dynamic, VecStorage<f64, Dynamic, Dynamic>>: Iterator
which is required by &ColumnIterMut<'_, f64, Dynamic, Dynamic, VecStorage<f64, Dynamic, Dynamic>>: rayon::iter::ParallelBridge &mut ColumnIterMut<'_, f64, Dynamic, Dynamic, VecStorage<f64, Dynamic, Dynamic>>: Send
which is required by &mut ColumnIterMut<'_, f64, Dynamic, Dynamic, VecStorage<f64, Dynamic, Dynamic>>: rayon::iter::ParallelBridge
Is there a relatively short path for making the code above work (with some changes to either the code or nalgebra source code)? I can do some digging on my own, I just need the direction. Thanks!
The text was updated successfully, but these errors were encountered:
Hi! We never attempted to make this kind of parallelisation possible with rayon so far. So I don’t have much advice to give. I don’t believe &ColumnIterMut can be modified to make it implement Send. So I feel like we would have to implement custom parallel iterators for nalgebra matrices.
One "simple" workaround I can think of is to convert the matrix to a slice and iterate on chunks:
I don't mean to commit myself to anything right now, but would y'all be amenable to a rayon feature for nalgebra that added support for parallel iterators over rows, columns, coefficients, ect? What would scoping out work like that entail?
I'm trying to make the following code work:
But the code doesn't compile:
Is there a relatively short path for making the code above work (with some changes to either the code or nalgebra source code)? I can do some digging on my own, I just need the direction. Thanks!
The text was updated successfully, but these errors were encountered: