simba 0.3.0

Scalar traits (`Real`, `Transcendental`) implemented for the Q32.32 `fixed::Fixed` of fixed-cairo: the Cairo counterpart of Dimforge's simba.

Readme

simba-cairo

Scalar traits for provable linear algebra in Cairo: the counterpart of Dimforge's simba.

In Rust, simba is a trait layer (RealField, ComplexField) implemented for the primitive f32 / f64; nalgebra is generic over T: RealField. Here the primitive is the Q32.32 fixed::Fixed and simba implements the traits for it; nalgebra-cairo is generic over T: Real.

Part of a stack porting reputable Rust crates to Cairo for provable game physics: fixed -> simba -> nalgebra -> rapier and fixed -> glam -> glamx -> rapier.

Package

Package Content simba Real (constants, helpers, fused kernels sum_prod* / diff_prod / norm*, the fixed::wide::Acc accumulator, prepared divisors div3..div16) and Transcendental, implemented for fixed::Fixed by delegation only (#[inline(always)], zero-cost: no arithmetic of its own)
[dependencies]
simba = "0.3.0"
fixed = "0.5.0"

The numeric specification (rounding, overflow, panic messages 'Fixed: ...') is fixed's. See docs/DESIGN.md.

Development

./scripts/check.sh (fmt, lint, build, tests, gas snapshot; --update refreshes gas/). CI job Consumer cost (scripts/consumer_cost.py, gates in consumer_cost.toml): at most 40,000 library lines, at most 5 s / 1 GB marginal cold-build cost, and the closure simba + fixed under 15 s / 3 GB. Measured locally: 711 library lines, closure with fixed 2.1 s / 0.24 GB over the no-dependency build. Toolchain pinned in .tool-versions (scarb 2.20.1, starknet-foundry 0.64.0).

Metadata

Version 0.3.0

Uploaded 11 hours ago

License MIT

Cairo version ^2.20.0

Size 16.4 KB

Installation

Run the following command in your project dir

scarb add simba@0.3.0

Or add the following line to your Scarb.toml

simba = "0.3.0"

Monthly downloads

Links

Keywords

  • math
  • scalar
  • fixed-point
  • linear-algebra
  • gamedev

Owners