Skip to main content

use_math/
lib.rs

1#![forbid(unsafe_code)]
2#![doc = include_str!("../README.md")]
3
4//! Utility-first facade for `RustUse` math crates.
5
6#[cfg(feature = "arithmetic")]
7pub use use_arithmetic as arithmetic;
8
9#[cfg(feature = "arithmetic")]
10pub use use_arithmetic::{
11    CheckedArithmetic, SaturatingArithmetic, WrappingArithmetic, checked_add, checked_div_ceil,
12    checked_div_floor, checked_is_divisible_by, checked_lcm, checked_mod_floor, checked_mul,
13    checked_sub, div_ceil, div_floor, mod_floor, saturating_add, saturating_mul, saturating_sub,
14    wrapping_add, wrapping_mul, wrapping_sub,
15};
16
17#[cfg(feature = "algebra")]
18pub use use_algebra as algebra;
19
20#[cfg(feature = "algebra")]
21pub use use_algebra::{
22    has_inverses, identity_element, is_abelian_group, is_associative, is_closed_under,
23    is_commutative, is_distributive_over, is_group, is_monoid, is_ring,
24};
25
26#[cfg(feature = "calculus")]
27pub use use_calculus as calculus;
28
29#[cfg(feature = "calculus")]
30pub use use_calculus::{
31    CalculusError, Differentiator, IntegrationInterval, Integrator, LimitApproximator,
32    central_difference, second_central_difference, simpson_integral, symmetric_limit,
33    trapezoidal_integral,
34};
35
36#[cfg(feature = "catalan")]
37pub use use_catalan as catalan;
38
39#[cfg(feature = "catalan")]
40pub use use_catalan::{CatalanError, catalan, fuss_catalan};
41
42#[cfg(feature = "combinatorics")]
43pub use use_combinatorics as combinatorics;
44
45#[cfg(feature = "combinatorics")]
46pub use use_combinatorics::{CombinatoricsError, combinations, factorial, permutations};
47
48#[cfg(feature = "complex")]
49pub use use_complex as complex;
50
51#[cfg(feature = "complex")]
52pub use use_complex::{Complex, Imaginary};
53
54#[cfg(feature = "geometry")]
55pub use use_geometry as geometry;
56
57#[cfg(feature = "geometry")]
58pub use use_geometry::{
59    Aabb2, Circle, GeometryError, Line2, Orientation2, Point2, Segment2, Triangle, Vector2,
60    aabb_from_points, distance_2d, distance_squared_2d, midpoint_2d, orientation_2d,
61    orientation_2d_with_tolerance, triangle_area, triangle_twice_area, triangle_twice_signed_area,
62    try_orientation_2d, try_orientation_2d_with_tolerance,
63};
64
65#[cfg(feature = "geode")]
66pub mod geode {
67    pub use use_geode::*;
68}
69
70#[cfg(feature = "geode")]
71pub use use_geode::{
72    GeodeError, TypeVector, catalan_from_geode_dimension, checked_factorial,
73    checked_product_factorials, diagonal_geode_2d, diagonal_geode_3d, diagonal_geode_4d,
74    exact_divide, face_count, geode_memoized, geode_on_first_axis, hyper_catalan,
75    polygon_edge_count, polygon_vertex_count,
76};
77
78#[cfg(feature = "integer")]
79pub use use_integer as integer;
80
81#[cfg(feature = "integer")]
82pub use use_integer::{
83    IntegerError, IntegerSign, are_coprime, classify_sign, gcd, is_divisible_by, is_even, is_odd,
84    lcm,
85};
86
87#[cfg(feature = "interval")]
88pub use use_interval as interval;
89
90#[cfg(feature = "interval")]
91pub use use_interval::{Bound, Interval};
92
93#[cfg(feature = "modular")]
94pub use use_modular as modular;
95
96#[cfg(feature = "modular")]
97pub use use_modular::{
98    Modular, is_congruent, mod_add, mod_inverse, mod_mul, mod_normalize, mod_pow, mod_sub,
99};
100
101#[cfg(feature = "prime")]
102pub use use_prime as prime;
103
104#[cfg(feature = "prime")]
105pub use use_prime::{
106    factorization, is_composite, is_prime, next_prime, previous_prime, prime_factors, primes_up_to,
107    sieve, unique_prime_factors,
108};
109
110#[cfg(feature = "polynomial")]
111pub use use_polynomial as polynomial;
112
113#[cfg(feature = "polynomial")]
114pub use use_polynomial::{Polynomial, linear_root, quadratic_roots};
115
116#[cfg(feature = "equation")]
117pub use use_equation as equation;
118
119#[cfg(feature = "equation")]
120pub use use_equation::{
121    LinearEquation, LinearSystem2, QuadraticEquation, RootSolver, Roots, solve_linear,
122    solve_quadratic,
123};
124
125#[cfg(all(feature = "equation", feature = "polynomial"))]
126pub use use_equation::solve_polynomial_degree_1_or_2;
127
128#[cfg(feature = "numerical")]
129pub use use_numerical as numerical;
130
131#[cfg(feature = "matrix")]
132pub use use_matrix as matrix;
133
134#[cfg(feature = "matrix")]
135pub use use_matrix::{Matrix2, Matrix3, Matrix4};
136
137#[cfg(feature = "linear")]
138pub use use_linear as linear;
139
140#[cfg(feature = "linear")]
141pub use use_linear::{LinearError, solve_2x2};
142
143#[cfg(feature = "vector")]
144pub use use_vector as vector;
145
146#[cfg(feature = "logic")]
147pub use use_logic as logic;
148
149#[cfg(feature = "logic")]
150pub use use_logic::{equivalence, exclusive_or, implication, majority, nand, nor};
151
152#[cfg(feature = "number")]
153pub use use_number as number;
154
155#[cfg(feature = "number")]
156pub use use_number::{
157    GOLDEN_RATIO, GOLDEN_RATIO_F32, NumberCategory, NumberSign, SQRT_3, SQRT_3_F32,
158    classify_number, classify_number_sign, is_finite_number,
159};
160
161#[cfg(feature = "probability")]
162pub use use_probability as probability;
163
164#[cfg(feature = "probability")]
165pub use use_probability::{
166    Bernoulli, Probability, ProbabilityError, independent_intersection, independent_union,
167};
168
169#[cfg(feature = "rational")]
170pub use use_rational as rational;
171
172#[cfg(feature = "rational")]
173pub use use_rational::{Rational, RationalError};
174
175#[cfg(feature = "real")]
176pub use use_real as real;
177
178#[cfg(feature = "real")]
179pub use use_real::{Real, RealError, RealInterval, approx_eq};
180
181#[cfg(feature = "series")]
182pub use use_series as series;
183
184#[cfg(feature = "series")]
185pub use use_series::{
186    SeriesError, arithmetic_nth_term, arithmetic_sum, geometric_nth_term, geometric_sum,
187};
188
189#[cfg(feature = "set")]
190pub use use_set as set;
191
192#[cfg(feature = "set")]
193pub use use_set::{
194    are_disjoint, contains_member, is_subset, set_difference, set_intersection,
195    set_symmetric_difference, set_union,
196};
197
198#[cfg(feature = "statistics")]
199pub use use_statistics as statistics;
200
201#[cfg(feature = "statistics")]
202pub use use_statistics::{
203    StatisticsError, mean, median, population_std_dev, population_variance, sample_std_dev,
204    sample_variance,
205};
206
207#[cfg(feature = "trigonometry")]
208pub use use_trigonometry as trigonometry;
209
210#[cfg(feature = "trigonometry")]
211pub use use_trigonometry::{
212    Angle, cos_deg, degrees_to_radians, normalize_degrees, normalize_radians, radians_to_degrees,
213    sin_deg, tan_deg,
214};
215
216pub mod prelude;