Re: [eigen] solveTriangularInPlace |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] solveTriangularInPlace
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Mon, 26 Jan 2009 00:05:28 +0100
- 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=/ylmKOXw+ojWo+LrPXCECjkoQDI7QbHY59Xx6X9FsOk=; b=mMy4nYkDvip30F80CY8amr/Er2jyjlp1sJ4vkLjdK1+JO4SuQSjvAwK1l7Hx+apYWu yn6DAHx8ZpMP1lpbi6phOLU1/1cYCdj71rrbuFWqrolVK2cU/ZfeZmMS5LAIIzOn77ni r+kp8ZpPfO/us/KnA5L2EWpN07+8SEwEIKaK4=
- 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=TW/IBiH8ijvJBPvanCmhcyv5YNzqFSfZl9bGbEXlY/qlRVat+GWGAhRESM3dA5Gpbx vl5sfzFonKsSihr177DvUc7IPBGAkdPKt+YUSiIJWhW03Sp6HSrimGUEIPJRgQJHF5ZZ YMLdENR0/B68hZk5m9uj4AFIB7GivFrFykrhs=
On Sun, Jan 25, 2009 at 10:55 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
> Hi,
>
> here is a patch that i am ready to commit, but i am not sure you'd
> like it, so let's discuss it.
>
> It improves LU::solve() by using a call like this:
> solveTriangularInPlace(c.corner(...));
> The problem is that currently solveTriangularInPlace takes a non-const
> reference, so the c++ compiler won't let me pass a temporary object
> here.
>
> We already met that problem for swap() and the solution we're using so
> far is to let swap take a const reference, and then const_cast it.
>
> The attached patch makes solveTriangularInPlace behave similarly.
>
> If you don't like it, the alternative is to construct named
> expressions and pass them to solveTriangularInPlace. But then we
> should be homogeneous and do the same for swap() which would mean
> goodbye to m.row(i).swap(m.row(j)) which frankly i think would be too
> bad. I much rather prefer to fail to honor constness here and document
> that. So, OK to commit?
I'm ok for that.
> Another thing while I'm here. solveTriangularInPlace takes blocks, and
> even blocks inside blocks. So when passed a corner(), it's using 2nd
> order blocks and even 3rd order blocks. This has been confusing
> compilers in the past. Here's a proposal to deal with that in a
> generic way: override methods such as block(), start(), corner(), etc,
> in the Block class, to return a plain block instead of a Block<Block>
> whenever possible. How useful do you think that can be?
this sounds to be a good idea. Actually this is more or less already
the case for block of expressions having the DirectAccessBit flag
because in that case Block is just like a Matrix. but for expressions
like (A+B).block().col(), yes this would probably help a lot the
compiler.
>
>