Luna-Generic
English documentation for the intended v0.3.3 release of Luna-Flow/luna-generic.
Overview
luna-generic provides general algebraic traits and default numeric instances for Luna projects.
The current release candidate centers on three changes:
BigIntis now part of the default exported numeric surface.- Integral-to-target conversions are expressed through explicit homomorphism traits.
Integral::normalizenow provides a canonicalBigIntform for all integral source types.
Exported Traits
AddMonoid,MulMonoidAddGroup,MulGroupSemiring,Ring,FieldIntegral,NatNatHomomorphism,IntegralHomomorphismNum
Exported Operations and Default Types
- Operations:
One,Zero,Inverse,Conjugate - Default numeric types:
Int,Int16,Int64,UInt,UInt16,UInt64,BigInt,Float,Double
Integer Model
NatcoversUInt,UInt16, andUInt64Integralcovers signed integers, unsigned integers, andBigInt- Unsigned integer instances stop at
Semiring Integral::normalizecanonicalizes any integral value intoBigIntNatreusesIntegral::normalizefor its exact embedding intoBigInt
Embeddings
NatHomomorphism::from_natprovides polymorphic target-side embeddings from anyNatsource typeIntegralHomomorphism::from_integralprovides polymorphic target-side embeddings from anyIntegralsource type- The default implementation strategy is
Integral::normalizefollowed by target-specificBigIntconversion BigIntembeddings are exactFloatandDoubleembeddings are approximate and may round large values
Validation
Recommended release checks:
bash
moon check
moon test