|Re: [eigen] Custom complex type|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
You should look at the NumTraits code -- the
example's a bit out of date in terms of what
enums and functions need to be implemented.
Also, there's a feature request regarding
mixed scalar types besides complex<real> * real:
- Bob Carpenter
On 6/7/11 7:25 AM, Nizar Khalifa Sallem wrote:
May be this page can help:
At Tue, 7 Jun 2011 15:04:37 +0900,
Pavel Holoborodko wrote:
[1<text/plain; ISO-8859-1 (7bit)>]
[2<text/html; ISO-8859-1 (quoted-printable)>]
Eigen's magicians, please advise on how to implement custom complex type for smooth integration with Eigen.
I plan to create multi-precision C++ complex scalar class based on MPC: http://www.multiprecision.org/index.php?prog=mpc.
MPC is cousin of MPFR from the same authors - http://mpfr.org.
There are two possible ways to proceed:
(1). Add template specialization for std::complex<mpfr::mpreal>.
(2). Create own scalar class something like mpcomplex based on low-level MPC.
Second option seems attractive from optimization point of view - minimum overhead, no conversion mpreal<-> MPC low level stuff is required.
There is only one problem - will it be possible to integrate such complex type with Eigen?
Documentation on NumTraits says:
"An enum value IsComplex. It is equal to 1 if T is a std::complex type, and to 0 otherwise."
Does it mean that only std::complex<T> custom complex types are supported in Eigen?
If yes, do I need to provide something besides NumTraits<std::complex<mpreal> > specialization?
Thanks in advance,