Indirect indexing
Issue #388
resolved
As far as I can tell, indirect indexing like in this Eigen v3.3.90 code snippet:
Array<int, 1, 9> v{0, 1, 2, 3, 4, 5, 6, 7, 8};
Array<int, 1, 3> i{6, 3, 0};
cout << v << endl << v(i) << endl;
which produces:
0 1 2 3 4 5 6 7 8
6 3 0
is not available in Blaze. Is that accurate?
Comments (4)
-
reporter -
Hi Paul!
Blaze approaches the problem by means of views, and in particular element selections:
blaze::DynamicVector<int> a{ 0, 1, 2, 3, 4, 5, 6, 7, 8 }; auto e = elements<6,3,0>( a ); // Select the elements 6, 3, and 0 std::cout << a << '\n' << e << '\n'; elements<1,2,3>( a ) = e; // Assign to the elements 1, 2, and 3 std::cout << a << '\n';
Output:
( 0 1 2 3 4 5 6 7 8 ) ( 6 3 0 ) ( 0 6 3 0 4 5 6 7 8 )
I hope this answers your question.
Best regards,
Klaus!
-
- changed status to resolved
-
Issue
#400was marked as a duplicate of this issue. - Log in to comment
BTW, Fastor (https://github.com/romeric/Fastor) also allows for indirect indexing: