Complex numbers
Feature description
Support for complex numbers in tensors.
Feature motivation
I saw your presentation on Scientific Computing in Rust and come to know burn. As I skim through the doc and issue list, it seems there's no complex number support yet. I'm writing some code for quantum computing simulation, and it'd be super cool to writing it in Rust, but I need complex numbers.
(Optional) Suggest a Solution
Perhaps we can add the most simplistic support for it by treating a complex number as a 2D vector with specific ops.
Trying to do something similar. Anybody mind if I work on this?
Seeing two options on how to do this:
- Treat complex as a special case of float tensors and basically reuse the existing FloatKind and FloatTensorPrimitive, and just handle complex-specific behavior in the ops.
- Make complex a first-class kind and introduce a ComplexKind, add ComplexTensorPrimitive and ComplexTensorOps. It’s more upfront work for backends, but keeps type system clean.
Any thoughts on what would be better @laggui ?
Complex numbers have different semantics than floats. I would opt for a different kind (option 2).
Since there are multiple possible ways of implementing complex tensors (mentioned here), and we want to support at least 2 of them (complex as a real and imaginary tensor and a tensor of complex primitives), what naming scheme for the types would make it clear which is which?
I'm guessing we don't want to wrap it in an enum but rather treat them as distinct kinds that support the same ops, partially because I suspect they won't be used interchangeably.