|Re: [eigen] Patch for diagonal matrix output|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Patch for diagonal matrix output
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sat, 3 Apr 2010 16:39:26 -0400
- 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:received:message-id:subject:from:to:content-type :content-transfer-encoding; bh=FkO67vSP1Eguk1x5/D7FkPLXlNkKiavuWwaP41bhyec=; b=R8LNtdW/F8pa63PQCDQTnb7Nltwn/may1EMTtxc/Yqq00Dpzl4M/dUv65x4mDZLeWl J4zpVsanxEdYEwN3LZR/3461P1xqUJpJNp9cZAIwCClf8UTNCIN4b9MWoXVutu0IHd1h RJT6bL1FitCrOndvD9y/eFyhk8rrDz35xZ+uY=
- 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=weZrlJNKP1a4UPKI3mLXFurN93aq/7oXHpx77eyq92np6kNxuT1J7rSEfonVs2/PHm O7o7GB5KRWvGjMQWHfhzWfP43SKIsMCry10/y9DRuTk0hYqUfQ8jA6RN+bQfj3Sd3XaG jppPNXnR9e4LpOJON3GRTQINpY/SZW3/n8xTM=
It is on purpose that the toDenseMatrix() method here isn't called
eval(). Calling it eval() is a bit ambiguous in the case of e.g. an
expression "diagonal of a sum of two matrices".
I understand the motivation for your patch and I agree that it's a
good idea, but I think that we can fix this in a better way: instead
of writing it separately for DiagonalBase and then separately again
for all special matrix types, we should be able to do it once and for
all at the level of EigenBase. We must just make sure that all
EigenBase-derived types implement toDenseMatrix(). (If not, that's
something we should fix. For MatrixBase, toDenseMatrix should be a
synonym of eval() ).
2010/4/2 Manoj Rajagopalan <rmanoj@xxxxxxxxx>:
> Hi eigen users and developers,
> I found I couldn't use the << operator to write a diagonal matrix to cout
> without having to convert to a dense matrix intermediate. So I wrote the
> attached patch. Please consider this for inclusion if it passes tests.
> The patch was created against the default branch from the root of the
> working copy directory.