[eigen] what to do with old flags like SelfAdjointBit |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] what to do with old flags like SelfAdjointBit
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sun, 22 Nov 2009 15:42:16 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=A52Iypj1w6Oz9Fq+mNjvsZ82I0X19PKAeUKhWv6ZqpY=; b=vcITddsvZhtq7kT07+5IV4rmA3Dff5ZPhnet+cZw0Zzlf3AIGq6B1rYwQbkO4nst8H NqZ5oMnTSEcyeurUeNtNa3mi3qTsJ3H1giEUl9iORC/JC7Bh4oidKkZUM4fOdKCSZ1eW g63u79MX52r16DZAorH5DSws1WTmKU1H/GdVY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=s3kvmvtAYWl1H4xansl4MCBNqygWMLgqf+EgzR+R2yY4Kd14Iy9H96Da8NyZAz2TQb 4dcF0KyDMbbTWnskFAX0kxxraNazuRgYazN4iAZ4BInmZCr5498zMh3AULhSNWV4jU8H B3+3Wd1ZWtWPIzvxcyd0kCYZnuuWHbVzbydpg=
Hi,
a long time ago, we thought that properties like "upper triangular" or
"self-adjoint" should be handled as MatrixBase Flags. We have long
changed our minds: they are now handled as special proxy classes like
TriangularView and SelfadjointView, and at the moment we dont even try
to offer storage classes for that. (Note that even in LAPACK, useful
triangular storage is only a recent/future feature.)
This leaves the question, what to do with the old bits such as
SelfAdjointBit, etc. Initially I just wanted to remove these enum
values, but I noticed that quite a bit of code (mainly in Sparse and
in Eigenvalues) is still checking for that bit and has special code
paths. If I just remove SelfAdjointBit, I have to remove that code
too, which is too bad. So instead, let's discuss right now what should
be the proper way to check for selfadjointness on generic types. Note
that i'm only using SelfAdjoint as an example: there are also all the
triangular shapes.
Solutions:
A. we can just keep SelfAdjointBit, just document well that MatrixBase
objects just never have that bit set, but other AnyMatrixBase classes
may still have it.
B. actually i suspect that it will be much more scalable to introduce
structs like this:
template<typename T> struct ei_is_selfadjoint
{
enum { ret = 0 };
};
which partial specializations like:
template< blabla > struct SelfAdjointView< blabla >
{
enum { ret = 1 };
};
C. unify all that in a single struct. We can't really put that in
ei_traits because we want to define that once and for all to 0 for all
MatrixBase objects, we don't want to have to write again and again in
all the ei_traits more boilerplate code. So perhaps ei_shape:
template<typename T> struct ei_shape
{
enum { ret = 0 };
};
which partial specializations like:
template< blabla > struct SelfAdjointView< blabla >
{
enum { ret = SelfAdjointBit };
};
Here, i think of ret as a bit-field. So SelfAdjointBit would survive
but it wouldn't have to have a special value different from MatrixBase
Flags bits. It could be just 1, etc...
Again, i used SelfAdjointBit as an example, think of all the
triangular flags here.
Benoit