reefer 0.3.0

Optimizing proc-macro for geometric algebra
Documentation
mod coeff_expr;

// Default to CAS-RS backend if another backend is not selected
#[cfg(feature = "backend_cas")]
mod cas_rs_field;

#[cfg(feature = "backend_cas")]
pub type ActiveField = cas_rs_field::CasRsField;

// #[cfg(feature = "backend_cas")]
// pub fn default_active_field() -> ActiveField {
//     ActiveField::new(parse_quote!(f32))
// }

// E-graph backend using egg (exploratory, not fully functional)
#[cfg(feature = "backend_egg")]
mod egg_field;

// #[cfg(feature = "backend_egg")]
// pub use egg_field::scalar_rewrites;

#[cfg(feature = "backend_egg")]
pub type ActiveField = egg_field::EggField;

// #[cfg(feature = "backend_egg")]
// pub fn default_active_field() -> ActiveField {
//     ActiveField::new_with_rules(parse_quote!(f32), scalar_rewrites())
// }

use abstalg::{AbelianGroup, CommuntativeMonoid, Domain, Monoid, SemiRing, Semigroup, UnitaryRing};

/// Abstraction over coefficient scalar fields used by symbolic Clifford algebras.
pub trait CoefficientField:
    Domain
    + CommuntativeMonoid
    + AbelianGroup
    + Semigroup
    + Monoid
    + SemiRing
    + UnitaryRing
    + Clone
    + std::fmt::Debug
{
    /// Embed a Rust expression into the field's element type.
    fn embed_expr(&self, expr: syn::Expr) -> syn::Result<<Self as Domain>::Elem>;
    /// Attempt to recover a Rust expression representing the field element.
    fn to_expr(&self, elem: &<Self as Domain>::Elem) -> syn::Result<syn::Expr>;
}