Re: [eigen] Dynamic memory allocation with Matrix::corner ? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Dynamic memory allocation with Matrix::corner ?
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 21 Jan 2010 11:48:23 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=n7PGe8LyoLR3qHQSOhNi1D3520f1fsICBXpzHPgXg4o=; b=Nfj2Hk3nRVh4U1ZHVUVqFB1HHQSNBhIJ8wg9J8AuW95uGXLmHEZ6tq5eCqzsYHCyTd K0TwKDTsWqn8Ehw2EmtSnakoHOXeK1/b8ICkKn0pZaHOq9oQB1ySp2m7UXWECfnGnJmy 55xZquYg0Npo4bJRBXY4kxS4YJyJt7jjxHris=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=GOimIEsbtBryBb7NdAGzw66Se4Xvaft64s5Ets4n6XiZDqhs+uYN8TZ5V03yOM6uwW WeuhxrVnpa6k9CasfPbXAGBL59Pyuz+TiP8MZAQGmKDDT8UbQ7WEG2fqsl4Z1aJfFRIb 50tkqgwaZGmu9ICtU8D539cL8nIwa79SrFibo=
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;
> }
>
>
>
>