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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#![crate_type = "lib"]
#[cfg(test)]
macro_rules! assert_float_eq(
($precision:expr, $given:expr , $expected:expr) => ({
match (&($precision), &($given), &($expected)) {
(precision_val, given_val, expected_val) => {
let diff = given_val-expected_val;
if diff.abs() > precision_val.abs() {
panic!("floats are not the same: (`{}`: `{:.15e}`, expected: `{:.15e}`, precision: `{:.15e}`, delta: `{:.15e}`)", stringify!($given), *given_val, *expected_val, *precision_val, diff )
}
}
}
})
);
#[cfg(test)]
macro_rules! assert_float_array_eq(
($precision:expr, $given:expr , $expected:expr) => ({
match (&($precision), &($given), &($expected)) {
(precision_val, given_val, expected_val) => {
assert_eq!(given_val.len(),expected_val.len());
for i in 0..given_val.len() {
assert_float_eq!(precision_val,given_val[i],expected_val[i]);
}
}
}
})
);
mod analytical;
mod float;
mod numerical;
pub use self::float::FloatType;
pub use self::analytical::biquadratic::find_roots_biquadratic;
pub use self::analytical::cubic::find_roots_cubic;
pub use self::analytical::cubic_depressed::find_roots_cubic_depressed;
pub use self::analytical::cubic_normalized::find_roots_cubic_normalized;
pub use self::analytical::linear::find_roots_linear;
pub use self::analytical::quadratic::find_roots_quadratic;
pub use self::analytical::quartic::find_roots_quartic;
pub use self::analytical::quartic_depressed::find_roots_quartic_depressed;
pub use self::analytical::roots::Roots;
pub use self::numerical::brent::find_root_brent;
pub use self::numerical::debug_convergency::DebugConvergency;
pub use self::numerical::eigen::find_roots_eigen;
pub use self::numerical::inverse_quadratic::find_root_inverse_quadratic;
pub use self::numerical::inverse_quadratic::Parabola;
pub use self::numerical::newton_raphson::find_root_newton_raphson;
pub use self::numerical::polynom::find_roots_sturm;
pub use self::numerical::regula_falsi::find_root_regula_falsi;
pub use self::numerical::secant::find_root_secant;
pub use self::numerical::simple_convergency::SimpleConvergency;
pub use self::numerical::Convergency;
pub use self::numerical::Interval;
pub use self::numerical::Sample;