Re: [eigen] Avoiding memory allocations with triangular solves |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Avoiding memory allocations with triangular solves
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Wed, 4 Jan 2012 13:37:18 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=6nfY393QogJXXblCY11X1kry30yTk1BoGuQhmyP5fng=; b=GUpsESwuaD1emdGR3ldhChjvur4eCqLalhcYAN0246OWU0s7JTiYHd6UmOnr63gMfZ e0dH/QB+cWalytiH6sH/WNyHfeXvtsrkmOJXof3GZL/Dzlpk8mSn/c8ks0cGQEJSZstP XnAoaJDVedsKhKBpesyy9KHW4KkkXRGNkeruE=
You should really use .col(l).segment(k,n) on both size to tell Eigen
you are dealing with vectors, and not matrices. A huge speedup as to
be expected :)
gael
On Wed, Jan 4, 2012 at 3:17 AM, Wenzel Jakob <wenzel@xxxxxxxxxx> wrote:
> Hi,
>
> I've run into performance issues when using Eigen to solve linear
> systems with PartialPivLU.
>
> Despite having pre-allocated all memory, the PartialPivLU::solve()
> function appears to perform dynamic memory allocation, which creates a
> bottleneck in my application. The code is structured as follows:
>
> /// Initialization
> Eigen::PartialPivLU<Eigen::MatrixXf> lu(n);
> lu.compute(...);
>
> while (...) { // main computation done here
> ...
> output.block(i, j, n, 1) = lu.solve(input.block(k, l, n, 1));
> ...
> }
>
> When profiling this code, most time is spent in malloc() and free()
> calls inside Eigen::internal::triangular_solve_matrix.
>
> Hence, I would like to ask how it is possible to avoid dynamic memory
> allocation when solving linear systems using Eigen's decompositions.
>
> Thanks!
> Wenzel
>
>
>