1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Constrained splines with monotonicity and convexity constraints
//!
//! This module provides spline interpolation methods with explicit constraints
//! on properties such as monotonicity (increasing or decreasing) and convexity
//! (convex or concave). These constraints are enforced through an optimization
//! approach that preserves these properties while still providing a smooth curve.
//!
//! Unlike the monotonic interpolation methods in the interp1d module, which use
//! specific basis functions or filtering, these methods use a more general
//! optimization-based approach to enforce constraints anywhere on the spline.
//!
//! Possible constraints include:
//! - Monotonicity (strictly increasing or decreasing)
//! - Convexity (convex or concave)
//! - Positivity
//! - Range constraints (min/max values)
//! - Fixed values at specific points
//! - Fixed derivatives at specific points
//!
//! These methods are particularly useful for:
//! - Economic modeling (utility functions, demand curves)
//! - Physical models with known constraints
//! - Cumulative distribution functions
//! - Probability density functions
//! - Yield curves and term structures
//!
//! # Module Structure
//!
//! This module is organized into several submodules:
//! - `types`: Core types like `ConstraintType`, `Constraint`, and `BoundaryCondition`
//! - `builder`: The `ConstrainedSplineBuilder` for constructing constrained splines
//! - `solver`: Internal solvers for constrained optimization problems
//! - `utils`: Utility functions for constraint matrix generation and checking
//! - `convenience`: High-level convenience functions for common use cases
pub
// Re-export the main public types and functions
pub use FittingMethod;
pub use ;
pub use ;
pub use ;
// Re-export the main methods from ConstrainedSpline