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 = "collatz")]
43pub use use_collatz as collatz;
44
45#[cfg(feature = "collatz")]
46pub use use_collatz::{
47    CollatzParity, CollatzRangeSummary, collatz_next, collatz_sequence, max_value_in_trajectory,
48    parity, parity_vector, reaches_one, stopping_time, total_stopping_time, trajectory_len,
49    verify_range,
50};
51
52#[cfg(feature = "combinatorics")]
53pub use use_combinatorics as combinatorics;
54
55#[cfg(feature = "combinatorics")]
56pub use use_combinatorics::{CombinatoricsError, combinations, factorial, permutations};
57
58#[cfg(feature = "complex")]
59pub use use_complex as complex;
60
61#[cfg(feature = "complex")]
62pub use use_complex::{Complex, Imaginary};
63
64#[cfg(feature = "geode")]
65pub mod geode {
66    pub use use_geode::*;
67}
68
69#[cfg(feature = "geode")]
70pub use use_geode::{
71    GeodeError, TypeVector, catalan_from_geode_dimension, checked_factorial,
72    checked_product_factorials, diagonal_geode_2d, diagonal_geode_3d, diagonal_geode_4d,
73    exact_divide, face_count, geode_memoized, geode_on_first_axis, hyper_catalan,
74    polygon_edge_count, polygon_vertex_count,
75};
76
77#[cfg(feature = "integer")]
78pub use use_integer as integer;
79
80#[cfg(feature = "integer")]
81pub use use_integer::{
82    IntegerError, IntegerSign, are_coprime, classify_sign, gcd, is_divisible_by, is_even, is_odd,
83    lcm,
84};
85
86#[cfg(feature = "interval")]
87pub use use_interval as interval;
88
89#[cfg(feature = "interval")]
90pub use use_interval::{Bound, Interval};
91
92#[cfg(feature = "modular")]
93pub use use_modular as modular;
94
95#[cfg(feature = "modular")]
96pub use use_modular::{
97    Modular, is_congruent, mod_add, mod_inverse, mod_mul, mod_normalize, mod_pow, mod_sub,
98};
99
100#[cfg(feature = "prime")]
101pub use use_prime as prime;
102
103#[cfg(feature = "prime")]
104pub use use_prime::{
105    factorization, is_composite, is_prime, next_prime, previous_prime, prime_factors, primes_up_to,
106    sieve, unique_prime_factors,
107};
108
109#[cfg(feature = "polynomial")]
110pub use use_polynomial as polynomial;
111
112#[cfg(feature = "polynomial")]
113pub use use_polynomial::{Polynomial, linear_root, quadratic_roots};
114
115#[cfg(feature = "equation")]
116pub use use_equation as equation;
117
118#[cfg(feature = "equation")]
119pub use use_equation::{
120    LinearEquation, LinearSystem2, QuadraticEquation, RootSolver, Roots, solve_linear,
121    solve_quadratic,
122};
123
124#[cfg(all(feature = "equation", feature = "polynomial"))]
125pub use use_equation::solve_polynomial_degree_1_or_2;
126
127#[cfg(feature = "eigen")]
128pub use use_eigen as eigen;
129
130#[cfg(feature = "eigen")]
131pub use use_eigen::{
132    EigenError, EigenMultiplicity, EigenSpace, Eigenpair, Eigensystem, Eigenvalue, Eigenvector,
133};
134
135#[cfg(feature = "numerical")]
136pub use use_numerical as numerical;
137
138#[cfg(feature = "matrix")]
139pub use use_matrix as matrix;
140
141#[cfg(feature = "matrix")]
142pub use use_matrix::{Matrix2, Matrix3, Matrix4};
143
144#[cfg(feature = "linear")]
145pub use use_linear as linear;
146
147#[cfg(feature = "linear")]
148pub use use_linear::{LinearError, solve_2x2};
149
150#[cfg(feature = "vector")]
151pub use use_vector as vector;
152
153#[cfg(feature = "vector")]
154pub use use_vector::{Vector, Vector2, Vector3, Vector4};
155
156#[cfg(feature = "logic")]
157pub use use_logic as logic;
158
159#[cfg(feature = "logic")]
160pub use use_logic::{equivalence, exclusive_or, implication, majority, nand, nor};
161
162#[cfg(feature = "number")]
163pub use use_number as number;
164
165#[cfg(feature = "number")]
166pub use use_number::{
167    GOLDEN_RATIO, GOLDEN_RATIO_F32, NumberCategory, NumberSign, SQRT_3, SQRT_3_F32,
168    classify_number, classify_number_sign, is_finite_number,
169};
170
171#[cfg(feature = "probability")]
172pub use use_probability as probability;
173
174#[cfg(feature = "probability")]
175pub use use_probability::{
176    Bernoulli, Probability, ProbabilityError, independent_intersection, independent_union,
177};
178
179#[cfg(feature = "rational")]
180pub use use_rational as rational;
181
182#[cfg(feature = "rational")]
183pub use use_rational::{Rational, RationalError};
184
185#[cfg(feature = "real")]
186pub use use_real as real;
187
188#[cfg(feature = "real")]
189pub use use_real::{Real, RealError, RealInterval, approx_eq};
190
191#[cfg(feature = "series")]
192pub use use_series as series;
193
194#[cfg(feature = "series")]
195pub use use_series::{
196    SeriesError, arithmetic_nth_term, arithmetic_sum, geometric_nth_term, geometric_sum,
197};
198
199#[cfg(feature = "set")]
200pub use use_set as set;
201
202#[cfg(feature = "set")]
203pub use use_set::{
204    are_disjoint, contains_member, is_subset, set_difference, set_intersection,
205    set_symmetric_difference, set_union,
206};
207
208#[cfg(feature = "statistics")]
209pub use use_statistics as statistics;
210
211#[cfg(feature = "statistics")]
212pub use use_statistics::{
213    StatisticsError, mean, median, population_std_dev, population_variance, sample_std_dev,
214    sample_variance,
215};
216
217#[cfg(feature = "trigonometry")]
218pub use use_trigonometry as trigonometry;
219
220#[cfg(feature = "trigonometry")]
221pub use use_trigonometry::{
222    Angle, cos_deg, degrees_to_radians, normalize_degrees, normalize_radians, radians_to_degrees,
223    sin_deg, tan_deg,
224};
225
226pub mod prelude;