Re: [eigen] Dynamic memory allocation with Matrix::corner ?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


2010/1/21 Jitse Niesen <jitse@xxxxxxxxxxxxxxxxx>:
> On Thu, 21 Jan 2010, hamelin.philippe@xxxxxxx wrote:
>
>> I just want to make sure that this code doesn't generate dynamic memory
>> allocation :
>>
>>
>> Matrix<double, 6, 6> large;
>> Matrix<double, 3, 3> small;
>>
>> large.corner(Eigen::TopLeft, 3, 3) = small;
>
> It does not. You can check that by compiling and running the program below
> (I saw this trick in test/nomalloc.cpp).
>
> Jitse
>
>
>
>
> // discard stack allocation as that too bypasses malloc
> #define EIGEN_STACK_ALLOCATION_LIMIT 0

good point, I was forgetting it!

Benoit


> // any heap allocation will raise an assert
> #define EIGEN_NO_MALLOC
>
> #include <Eigen/Core>
>
> using Eigen::Matrix;
>
> int main()
> {
>  Matrix<double, 6, 6> large;
>  Matrix<double, 3, 3> small;
>  large.corner(Eigen::TopLeft, 3, 3) = small;
> }
>
>
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/