Re: [eigen] Map with negative outer stride |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
On 02.02.2015 16:48, Chen-Pang He wrote:
#define EIGEN_NO_DEBUG // Disable eigen_assert
#include <Eigen/Core>
#include <iostream>
int main()
{
using namespace Eigen;
int data[] = { 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6 };
std::cout << Map<Matrix<int, 6, 6>, 0, OuterStride<-1> >(data + 5, 6, 6)
<< std::endl;
}
Too lazy to actually test it, but the following should work without disabling assertions:
Map<Matrix<int, 6, 6>, 0, OuterStride<1> >(data, 6, 6).rowwise().reverse()
This still requires a temporary vector with leading zeros. If you want to avoid that, I guess you need to write a small loop or write a CustomNullaryOp:
http://eigen.tuxfamily.org/dox-devel/classEigen_1_1DenseBase.html#a5b84f7ce5cc30b011683e3c2c6d816a8
Christoph
--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen
Tel: +49 (421) 218-64252
----------------------------------------------
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |