[eigen] bug in assigning triangularView to MatrixBase |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: Eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] bug in assigning triangularView to MatrixBase
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Tue, 3 Aug 2010 23:25:34 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=oicXKWdaMGV4WEfA4CQftLD6IX03PAYnLHMjMoSRoLM=; b=R0YRIOwhFNKKIYcv0faBW2EbfUWL9d1aU8jRiTzQusnunj1H2p0FKVgneFaRFkPLJq BXfTIlbUInd9s1EN2sGxoVFMCOvWVcsg+wy1z2biUvFx/XfUvJ/D3xLtAnnoNaH9/ea3 IwEGRb78J6dLmiT4gsW6s6TrIiqyIoKVqeLN0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=QNbnDCir3SbCebQc1qp81cV2W1AYxR5m8yB4GfUTJTKZqFixf7bZGIPjUMrRCJ9ICJ jSa2Rw9ASw6I1D2HKnoqaU8N2ZUFjFnMt4BBq4Gs2Q92hcTk/QG3gZSlT1gP6/EwLJZh cSVZCxr3r2YJsQE2jSR5yomx0fz1+4ATSun+U=
Hi,
this time I found a real one. ;)
The code below crashes because
MatrixBase<Derived>::operator=(EigenBase) is directly calling evalTo
without resizing.
I tried to template just a MatrixType and the the code is working
because Matrix<Derived>::operator=(EigenBase) calls
DenseStorageBase::operator=(EigenBase) which does the resizing before
calling MatrixBase<Derived>::operator=(EigenBase).
The question is where do we put the resizing code in order to be sure
we don't run into any trouble again?
I was wondering about putting the resize close to evalTo and did a
quick grep. ReturnByValue will cause the same troubles when it is used
in functions taking MatrixBase<Derived>.
- Hauke
-----
template <typename Derived>
void crash(const MatrixBase<Derived>& M, MatrixBase<Derived>& N)
{
HouseholderQR<Derived> qr(M);
N = qr.matrixQR().triangularView<Upper>();
}
void main()
{
const int size = 50;
typedef MatrixXd MatrixType;
MatrixType N,M = MatrixType::Random(size,size);
crash(M,N);
}