[eigen] SelfAdjointView<> as LHS expression for optimizations? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] SelfAdjointView<> as LHS expression for optimizations?
- From: Jose Luis Blanco <joseluisblancoc@xxxxxxxxx>
- Date: Fri, 5 Nov 2010 20:49:55 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=uJGk+IyPeDAvOyo5zLQYlSsuWF1iivAhZnI/aV1YyLc=; b=NoucdvVQtH0MPcKrlcQ8KVN1WIDTFw6sFITmAV3PwGiGQoMRkfx7lGtNQ38SMyPQp8 2d/zU1T8isr2rw2T6UiZZSqmXbeAKM0rLpC4KMdkLGEr5xyqF5nuLvOp1KyHxLP7K8Jy vtXtqdlpw1qTUZiFAmJHJxtJY1bKgPKlEGWhs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ZkAzRhyfrzcIcG1sULl5BN8A5vnPuRKeldGQNDkc1i7dqjYmbS7EY0hUvK+iFKo52t cQvEl1QBod3NzT1HZPHI6fDiCXigXz0FL4mxdG2j4OQYb/5STMfeh8eRihk0cZHPSAm0 ipw8BReTrKTvyNcVCptrwk+sVl6WHNODnK5lk=
Hi all,
The operation I have in mind is:
RESULT = H * C * H.transpose()
with C symmetric and squared.
The point is that two "problems" (well... I have to admit, small
ones!) occur with a naive Eigen expresion "H * C * H.transpose()":
1) Many multiplications could be saved by realizing that the result is
exactly symmetric. I know the implications may be far reaching, but,
could SelfAdjointView<> be extended so it can be used to store
results? I mean, something like:
Eigen::MatrixXd RESULT;
RESULT.selfadjointView<Eigen::Lower>() =
H*C.selfadjointView<Eigen::Lower>()*H.transpose();
or an alternative that wouldn't require LHS = operator for SelfAdjointView<>:
Eigen::MatrixXd RESULT =
(H*C.selfadjointView<Eigen::Lower>()*H.transpose()).selfAdjointView<Eigen::Lower>();
Any ideas about the difficulty of implementing any of these two ideas?
Or... is there anything similar already done?
2) Apart from efficiency, there is this numerical accuracy problem of
the resulting matrix not being *exactly* symmetric... a*b*c != c*b*a
for most architectures. Ok, the errors are tiny, but it may lead to
inconsistencies that some time ago affected the Cholesky
implementation I used to use... that's why I worry about all this in
the first place!
Best,
JL