-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make std::complex<DualNumber> work #66
Comments
Hm, I guess complex numbers are not necessary if we can assume the matices are symmetrical. |
I do hope you've got another way out of this. In my experience those specializations are often workable in practice, but not always; I must have hit a compiler that agreed with the standard instead of with me at some point, or I wouldn't have remembered the disagreement. To be fully portable you wouldn't be able to just specialize std::complex; you'd have to create MetaPhysicL::complex, as well as versions of all the functions you'd want to act on that. |
Looks like even boost might have run into this problem? They at least try to specialize |
I'm running into this issue more generally while converting some MOOSE objects that utilize |
So the answer would be to roll our own |
I absolutely hate this, but: yes, probably. It would be a shim to std::complex for float/double/long double, and to a new And it would be incredibly annoying but I fear it would be the only way to guarantee things not breaking with some new compiler years down the road. We could probably make |
Yeah, I was thinking fallback to std::complex for supported types would be
best. I'm guessing there might be compiler optimizations hinging on the
restrictive templating of std::complex
…On Wed, Mar 10, 2021 at 8:29 AM roystgnr ***@***.***> wrote:
So the answer would be to roll our own moose::complex number type?!
I absolutely hate this, but: yes, probably. It would be a shim to
std::complex for float/double/long double, and to a new
MetaPhysicL::complex<T> for MetaPhysicL types, and to
boost::multiprecision::complex128 for quad precision builds ...
And it would be incredibly annoying but I fear it would be the only way to
guarantee things not breaking with some new compiler years down the road.
We could probably make std::complex<MetaPhysicL::foo> a shim to
MetaPhysicL::complex<foo>, so that on compiler+library combinations which
support it we'd get additional backwards compatibility with generic codes
that explicitly reference std::complex rather than using
context-dependent namespace lookup, but I'd want to rely on that as little
as possible.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#66 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABRMPWM25P2INU2IHIRFHTTC564JANCNFSM4T5CM4SA>
.
|
We're looking into using the Eigen library to obtain eigen decompositions of matrices of dual numbers. This is of course because LAPACK precludes us from using dual numbers entirely while Eigen is beautifully templated.
I seem to have hit a snag though as there are a bunch of functions used in
<complex>
that are not overloaded (or specialized) for dual numbers. This results in errors likeand
The text was updated successfully, but these errors were encountered: