Generic complex-number types and algebraic operations for LunaFlow, with floating analytic backend functions in the float_backend subpackage.
Dependencies
moon add Luna-Flow/luna-complex@0.3.1// moon.pkg
import {
"Luna-Flow/luna-complex" @complex,
"Luna-Flow/luna-complex/float_backend" @fb,
}fn main {
let z = @complex.Complex::new(-3.0, 4.0)
let w = @complex.Complex::new(1.0, 2.0)
println("z * w = \{z * w}")
println("|z| = \{@fb.abs(z)}")
println("sqrt(z) = \{@fb.sqrt(z)}")
}z * w = -11 + -2i
|z| = 5
sqrt(z) = 1 + 2i| Package | Purpose |
|---|---|
| Luna-Flow/luna-complex | generic Complex[T]: construction, in-place setters, arithmetic, conjugation, Zero … Field instances |
| Luna-Flow/luna-complex/float_backend | Complex[Double] analytic functions as free functions (abs, arg, div, sqrt, exp, log, pow, trigonometric and hyperbolic functions and inverses); capability traits FloatingAnalyticScalar, FloatingSpecialValues, FloatingBackendScalar |
Install
Download zipGeneric complex-number types and algebraic operations for LunaFlow, with floating analytic backend functions in the float_backend subpackage.
Dependencies