Re: [eigen] Pre-allocating LU objects |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Pre-allocating LU objects
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Fri, 21 May 2010 17:03:03 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=nDRZr7K7Y8jXMs5NGQRTUKsVcThzRINvJR/m0FbnrbI=; b=SkAaFpIT8x3SVsCkVPJvIsiDnQKF073QbpvgnJTu9KEnreeOgrhn63yyWyUascU5eK qQvhvoVIaZA5Py4nrI8qCYzn86+DI57O2kUv4YXYLVSVN2zL0C56j02EzGEFDYLq+nZ2 s1Q14/37qFHOMEAdkhQFtWg40+C5t8h2D0qk0=
- 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=b67RiXgiGcaibbzxgp91Bq/qDFwgGitw94gVeGZzJdx1Qc/VZ4nvbQ6GRIipqUaMoX V2z7M9eY1uh2P+r8eIMUTAPcubVIEXqbz2/2/DiAyOt2sbe7RRbN4s8pXKyobJgX+3J0 kUWiFODpygOsoGLo2H2yy3YZuKW/5Wnrc6qA4=
The FullPivLu ctor taking two ints is there in Eigen3, in
Eigen/src/LU/FullPivLU.h, and as you can see in the initialization
list, it does allocate the LU matrix and other data members. See
recent thread with Adolfo on this list, he added that feature to all
our decompositions.
Benoit
2010/5/21 Manoj Rajagopalan <rmanoj@xxxxxxxxx>:
>
> I don't seem to be able to find these names in Eigen3. Were they part of
> Eigen2?
>
> thanks,
> Manoj
>
>
>
> On Friday 21 May 2010 01:22:24 pm Vincent Lejeune wrote:
>> As far as I know, there is already a constructor of MatrixPivLU that takes
>> 2 ints. However I don't know if it does allocate a matrix...
>>
>> MatrixPivLu::Compute(matrix) does copy your matrix in its m_lu member
>> before doing any computation, performance may suffer. I suggest you use the
>> lower level makeluinplace() method if performance is critical in your
>> application.
>>
>> --------------------------------------------------
>> From: "Manoj Rajagopalan" <rmanoj@xxxxxxxxx>
>> Sent: Friday, May 21, 2010 6:46 PM
>> To: <eigen@xxxxxxxxxxxxxxxxxxx>
>> Subject: [eigen] Pre-allocating LU objects
>>
>> > Hi,
>> >
>> > I am writing code where I am pre-allocating a bunch of Eigen3 objects
>> > and
>> > reusing them O(10^5) times in my simulation. Therefore, I am trying to
>> > push
>> > as much as possible of the memory allocation to the sim initialization
>> > before
>> > the main loop.
>> >
>> > FullPivLU and PartialPivLu don't seem to have constructors that just
>> > resize
>> > them initially. They seem to get resized only when a matrix is passed as
>> > CTOR
>> > argument or when the compute() method is called. My sim uses the default
>> > CTOR
>> > and calls compute() later with the matrix to be factorized but the size
>> > of the matrix is the same throughout.
>> >
>> > Most resize methods check the provided sizes against the currently
>> > allocated size before actually performing the new[] and I am guessing
>> > Eigen
>> > code does this too. So the first call to ??PivLU::compute() in my code
>> > should
>> > cause allocation and the rest of them should be no-ops because I am
>> > always solving the same-size matrix. Am I right in concluding that the
>> > performance
>> > hit due to invasive scratch-memory allocation in ??PivLU should therefore
>> > be
>> > minimal?
>> >
>> > Will it be a good idea to include a CTOR that takes only size arguments
>> > (dynamic, not static) and allocates the scratch memory that these classes
>> > use
>> > at instantiation?
>> >
>> > Thanks,
>> > Manoj
>
>
>
>