|Re: [eigen] Unifying decomposition interfaces|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Unifying decomposition interfaces
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 20 May 2009 14:16:42 +0200
- 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=aSkAom/hKunlCN6HjUjYUH6JWO1aMhyX5Jl1P4kztc0=; b=NmOXTwEXgwHTnFEqFX8CnEJjqUyS8dCcxn5tsOJbudmQTFsYdAC9Qx4EXMrpqIjgSv Inrfq1PbPHSr5LiSiPCEBMmmzcsP/L488CoyoB2fJ5ibGW4GpVD5PreasmbBoyaiSyY4 QsWabJ33J2Hmf3R9qdckEzVEw3KY35Zga+APk=
- 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=l1OuE99FTdeZHnEP2diUT1KK4Y5q2sSaG7OvQvlHhLNIr+HqyipffgCWBi4Hg09MST Llas5rWY6biNFZJiD6Frx/S3zkOpMohJmR8YRm6fsFeddIwbXR6QVCe+fUMKXGSPkHdA j2Qq20yccB1Yr5JfZ7+RmdOUOrE3icyKJ2kKo=
2009/5/20 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> Hi there,
> I recognized that some of Eigen's decompositions offer a public method
> void compute(MatrixType&)
> while others do not. IMHO, a public compute method is useful - it
> allows the user to reuse decomposition objects without the need to
> allocate the required intermediate members on and on. A particular use
> case in which I need this is for the Eigenvalue decomposition.
> Consider the case in which you want to compute the Eigenvalue
> decompositions of the Hessian (just a 2x2 matrix in this case) of each
> pixel in an image. Recreating the decomposition object in this case is
> unnecessary and actually costs a lot of time.
In such an extreme case as 2x2, eventually we want to have fixed-size
specializations for all decompositions.
But your point still holds for slightly larger sizes like 8x8.
> I tried to unify the decomposition interfaces (PartialLU, LU, QR, SVD,
> Cholesky, Eigensolver) in the following way:
> 1) if not already existing, add a public method 'void compute(MatrixType&)'
> 2) add a default ctor to all decompositions
I agree with this change
> The second step is required in order to spare the user from the need
> of creating decomposition objects with a dummy matrix in cases they
> actually intend to use them via compute(...).
> I created a fork with the required changes and would like to hear your
> opinions about them and the idea in general.
> The fork can be found here: http://bitbucket.org/hauke/eigen2/overview/
I just had a look at LU and have 2 remarks.
a) we'll have to decide how to guard against using an uninitialized
decomposition. I would like to advocate using ei_assert(). In
decompositions that store a pointer to the original matrix, this is a
great thing to test for. Otherwise add a bool m_initialized member.
b) you name the pointer m_pOriginalMatrix. So far we didn't do the
"p". I would advocate m_originalMatrix: the compiler takes care
already of checking that we're remembering that it's a pointer (so we
must use ->...)