iliekturtles / uom

Units of measurement -- type-safe zero-cost dimensional analysis
Apache License 2.0
980 stars 90 forks source link

Can I use complex numbers (num-complex) with uom? #286

Open TobTobXX opened 2 years ago

TobTobXX commented 2 years ago

Now, I know this is unusual, but it actually comes up in quantum physics. I tried some stuff like using uom::si::quantities::Length<Complex64>, but then the compiler tells me that uom::Conversion somehow isn't implemented.

Am I missing something? Or is this indeed something that could be worked on in the uom library?

iliekturtles commented 2 years ago

uom can't currently support arbitrary underlying storage types such as Complex64. See #122 for context. Since Complex<T> is part of num adding support for Complex32 and Complex64 shouldn't be too much effort.

For anyone interested in submitting a PR see e2d5f20e4f55ec06bcfaee7299e5f18c33617706 for the last time an underlying storage type was added. I expect Complex implementations would look like a cross between f32/f64 and Rational32/Rational64.