amari_enumerative/
lib.rs

1//! # Amari Enumerative Geometry
2//!
3//! This crate provides enumerative geometry capabilities for the Amari mathematical library.
4//! It implements intersection theory, Schubert calculus, and tools for counting geometric
5//! configurations such as curves, surfaces, and higher-dimensional varieties.
6//!
7//! ## Features
8//!
9//! - **Intersection Theory**: Chow rings, intersection multiplicities, and Bézout's theorem
10//! - **Schubert Calculus**: Computations on Grassmannians and flag varieties
11//! - **Gromov-Witten Theory**: Curve counting and quantum cohomology
12//! - **Tropical Geometry**: Tropical curve counting and correspondence theorems
13//! - **Moduli Spaces**: Computations on moduli spaces of curves and surfaces
14//!
15//! ## Usage
16//!
17//! ```rust
18//! use amari_enumerative::{ProjectiveSpace, ChowClass, IntersectionRing};
19//!
20//! // Create projective 2-space
21//! let p2 = ProjectiveSpace::new(2);
22//!
23//! // Define two curves
24//! let cubic = ChowClass::hypersurface(3);
25//! let quartic = ChowClass::hypersurface(4);
26//!
27//! // Compute intersection number (Bézout's theorem)
28//! let intersection = p2.intersect(&cubic, &quartic);
29//! assert_eq!(intersection.multiplicity(), 12); // 3 * 4 = 12
30//! ```
31
32#[cfg(test)]
33pub mod comprehensive_tests;
34pub mod verified_contracts;
35
36pub mod geometric_algebra;
37#[cfg(feature = "gpu")]
38pub mod gpu;
39pub mod gromov_witten;
40pub mod higher_genus;
41pub mod intersection;
42pub mod moduli_space;
43pub mod performance;
44pub mod schubert;
45pub mod tropical_curves;
46
47// Re-export core types
48pub use geometric_algebra::{
49    quantum_k_theory, signatures, GeometricProjectiveSpace, GeometricSchubertClass,
50    GeometricVariety,
51};
52pub use gromov_witten::{CurveClass as GWCurveClass, GromovWittenInvariant, QuantumCohomology};
53pub use higher_genus::{
54    AdvancedCurveCounting, DTInvariant, HigherGenusCurve, JacobianData, PTInvariant,
55};
56pub use intersection::{
57    AlgebraicVariety, ChowClass, Constraint, Grassmannian, IntersectionNumber, IntersectionPoint,
58    IntersectionRing, MockMultivector, ProjectiveSpace, QuantumProduct,
59};
60pub use moduli_space::{CurveClass, ModuliSpace, TautologicalClass};
61pub use performance::{
62    CurveBatchProcessor, FastIntersectionComputer, MemoryPool, SparseSchubertMatrix,
63    WasmPerformanceConfig,
64};
65pub use schubert::{FlagVariety, SchubertCalculus, SchubertClass};
66pub use tropical_curves::{
67    TropicalCurve, TropicalEdge, TropicalIntersection, TropicalModuliSpace, TropicalPoint,
68};
69
70use thiserror::Error;
71
72/// Error types for enumerative geometry computations
73#[derive(Error, Debug, Clone, PartialEq)]
74pub enum EnumerativeError {
75    /// Invalid dimension for the ambient space
76    #[error("Invalid dimension: {0}")]
77    InvalidDimension(String),
78
79    /// Intersection computation failed
80    #[error("Intersection error: {0}")]
81    IntersectionError(String),
82
83    /// Schubert calculus error
84    #[error("Schubert calculus error: {0}")]
85    SchubertError(String),
86
87    /// Gromov-Witten invariant computation error
88    #[error("Gromov-Witten error: {0}")]
89    GromovWittenError(String),
90
91    /// General computational error
92    #[error("Computation error: {0}")]
93    ComputationError(String),
94}
95
96/// Result type for enumerative geometry computations
97pub type EnumerativeResult<T> = Result<T, EnumerativeError>;
98
99// GPU acceleration exports
100#[cfg(feature = "gpu")]
101pub use gpu::{
102    EnumerativeGpuConfig, EnumerativeGpuContext, EnumerativeGpuError, EnumerativeGpuOps,
103    EnumerativeGpuResult, GpuGromovWittenData, GpuIntersectionData, GpuSchubertClass,
104};
105
106#[cfg(test)]
107mod tests {
108
109    #[test]
110    fn test_library_compiles() {
111        // Basic smoke test to ensure the library compiles
112        let _compiled = true;
113    }
114}