apex_solver/lib.rs
1//! # Apex Solver
2//!
3//! A comprehensive Rust library for nonlinear least squares optimization, specifically designed
4//! for computer vision applications such as bundle adjustment, graph-based pose optimization, and SLAM.
5//!
6//! ## Features
7//!
8//! - **Multiple Optimization Algorithms**: Gauss-Newton, Levenberg-Marquardt, and Dog Leg solvers
9//! - **Flexible Linear Algebra Backend**: Support for both Sparse Cholesky and Sparse QR decomposition
10//! - **Configurable Solver System**: Easy-to-use configuration system for algorithm and backend selection
11//! - **High Performance**: Built on the faer linear algebra library for optimal performance
12//! - **Comprehensive Testing**: Extensive test suite ensuring correctness and reliability
13//!
14//!
15//! ## Solver Types
16//!
17//! - **Gauss-Newton**: Fast convergence for well-conditioned problems
18//! - **Levenberg-Marquardt**: Robust algorithm with adaptive damping
19//! - **Dog Leg**: Trust region method combining Gauss-Newton and steepest descent
20//!
21//! ## Linear Algebra Backends
22//!
23//! - **Sparse Cholesky**: Efficient for positive definite systems
24//! - **Sparse QR**: More robust for rank-deficient or ill-conditioned systems
25
26// Re-export workspace crates
27pub use apex_camera_models;
28pub use apex_io;
29pub use apex_manifolds;
30
31// Create module aliases for backward compatibility
32pub mod manifold {
33 pub use apex_manifolds::*;
34}
35
36pub mod camera_models {
37 pub use apex_camera_models::*;
38}
39
40// Re-export commonly used types from workspace crates
41pub use apex_camera_models::{
42 CameraModel, CameraModelError, DoubleSphereCamera, EucmCamera, FovCamera, KannalaBrandtCamera,
43 PinholeCamera, RadTanCamera, UcmCamera,
44};
45
46// Re-export optimization configuration types from factors module
47pub use apex_io::{BalLoader, G2oLoader, Graph, ToroLoader};
48pub use apex_manifolds::{
49 Interpolatable, LieGroup, ManifoldType, Tangent, rn::Rn, se2::SE2, se3::SE3, so2::SO2, so3::SO3,
50};
51pub use factors::{
52 BundleAdjustment, LandmarksAndIntrinsics, OnlyIntrinsics, OnlyLandmarks, OnlyPose,
53 OptimizeParams, PoseAndIntrinsics, SelfCalibration,
54};
55
56// Local modules
57pub mod core;
58pub mod error;
59pub mod factors;
60pub mod linalg;
61pub mod linearizer;
62pub mod logger;
63pub mod observers;
64pub mod optimizer;
65
66// Re-export core types
67pub use core::variable::Variable;
68pub use error::{ApexSolverError, ApexSolverResult, ErrorLogging};
69
70// Re-export factor types
71pub use factors::{BetweenFactor, Factor, PriorFactor, ProjectionFactor};
72
73// Re-export linear algebra types
74pub use linalg::{
75 DenseCholeskySolver, DenseMode, DenseQRSolver, JacobianMode, LinearSolver, LinearSolverType,
76 LinearizationMode, SparseCholeskySolver, SparseMode, SparseQRSolver,
77};
78
79// Re-export logger
80pub use logger::{init_logger, init_logger_with_level};
81
82// Re-export optimizer types
83pub use optimizer::{
84 LevenbergMarquardt, OptObserver, OptObserverVec, Optimizer, OptimizerType,
85 levenberg_marquardt::LevenbergMarquardtConfig,
86};
87
88#[cfg(feature = "visualization")]
89pub use observers::{RerunObserver, VisualizationConfig};