[eigen] Tiny matrix in Eigen2 |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Tiny matrix in Eigen2
- From: WANG Xuewen <xuewen.wang@xxxxxxxxx>
- Date: Thu, 17 Sep 2009 10:33:40 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=+gQIc4vzR1PLjVPzc5Ax2ARzETLRpsxj5XmN61qo7dk=; b=LSZ6mFRHrSwx+B1uVMQvWRyWeFY9aak9aQAPcXHCL0wgk6a5kDq3ykuqzeJwvJrRS3 P7++3OLB1CUXREmbCCutfN5/QJ/h+9hREGbJN6Ngp71W7s1Coe7nTMg6aGwgTldW/RML HnnpxrBc7SpE0B+smOFeoYKSQ89GR6Sh991nI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=OshWSRG88uP14HNWZai7VSN3wIOMtC2Av+WSFFubYQQisgZlDT4HPbWCsH5AhNj6b8 GMwdDbj9Ogwm7dXyZ7W4qTY7yN1lCbK6UEBBkO1fHgEvTctbnmYFaVtBGcgGXKrvuvfR RAp3NpwgGFOAhpo+Klakzrt02DXsU2/QGHaLk=
Hi,
We are trying to replace our home made matrix vector library with Eigen2
which provides an unified interface between tiny matrix and medium size
matrix and sounds promising on performance. Surprisingly, it is 10%
slower for tiny matrix (with 2.0.5, not sure about the devel branch
since same code doesn't compile using it), so I wonder if there is
something wrong that I've made and anything that can help improving it.
Our tiny matrix whose dimension limits to 7 but the exact dimension is
not known at compile time. The most costly computation on the matrix is
to compute the exponential of a real or complex matrix. We use the
method similar to MatrixExponential in unsupported.
I've used something like
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic,
Eigen::RowMajor | Eigen::DontAlign,
NMaxTinyMatrixDimension, NMaxTinyMatrixDimension>
TinyRMatrix;
typedef Eigen::Matrix<std::complex<double>, Eigen::Dynamic, Eigen::Dynamic,
Eigen::RowMajor | Eigen::DontAlign,
NMaxTinyMatrixDimension, NMaxTinyMatrixDimension>
TinyCMatrix;
typedef Eigen::Matrix<double, Eigen::Dynamic, 1,
Eigen::RowMajor | Eigen::DontAlign,
NMaxTinyMatrixDimension, 1>
TinyRVector;
typedef Eigen::Matrix<std::complex<double>,
Eigen::Dynamic, 1,
Eigen::RowMajor | Eigen::DontAlign,
NMaxTinyMatrixDimension, 1>
TinyCVector;
Where NMaxTinyMatrixDimension is 7.
My questions are:
1. Is the chosen storage the right choice for my problem? Should I just
use Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> etc?
2. Even if the storage is in the stack, but the dimension is not known
at compile time. Will the loop get unrolled for most operations?
3. We do something like M = N + scalar * Matrix::Identity(); as seen in
unsupported. Is this optimal? Does it really matter?
4. Our internal library stores a complex matrix by using two matrix, one
for the real part and another for the imaginary part. It seems that this
improves but is it still preferred even with Eigen2?
Sorry that I don't know (yet) much about the internal of Eigen2 so
haven't figured out the answer to my questions myself so your
suggestions will be very appreciated.
thanks,
Xuewen
P.S. I'm sorry if you have received the mail twice since apparently I
used the wrong email address the first time.