In the docs, the numeric types are INT, FLOAT, or Decimal. I'm wondering if it's aligned with the goals of the rhai project to add support for a Complex type that defaults to storing real and imaginary components as (2) f64 fields.
I'm working on a REPL that automatically loads rhai-sci, and wondering how complex matrix operations might work, and thinking it might be nice if a Complex number type was eventually built-in to rhai. There's already complex number support in nalgebra, which I believe rha-sci depends on:
Numpy and MATLAB both use "1i" or "1j" to represent an imaginary component, and this seems like good syntax - i.e. "let a = 2.0 + 1j * 3.5" would create a complex number. There would have to be some associated functions for arithmetic, sine, cosine, exponentials, etc.
Does that sound like a reasonable idea? I'm interested to prototype this and submit a PR. Any pointers on where to start or things to look for are appreciated.
In the docs, the numeric types are INT, FLOAT, or Decimal. I'm wondering if it's aligned with the goals of the rhai project to add support for a
Complextype that defaults to storing real and imaginary components as (2) f64 fields.I'm working on a REPL that automatically loads
rhai-sci, and wondering how complex matrix operations might work, and thinking it might be nice if aComplexnumber type was eventually built-in to rhai. There's already complex number support in nalgebra, which I believerha-scidepends on:Numpy and MATLAB both use "1i" or "1j" to represent an imaginary component, and this seems like good syntax - i.e. "let a = 2.0 + 1j * 3.5" would create a complex number. There would have to be some associated functions for arithmetic, sine, cosine, exponentials, etc.
Does that sound like a reasonable idea? I'm interested to prototype this and submit a PR. Any pointers on where to start or things to look for are appreciated.