Skip to content

Commit 732ca91

Browse files
committed
change api
1 parent eeb251e commit 732ca91

File tree

7 files changed

+16
-19
lines changed

7 files changed

+16
-19
lines changed

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn main() {
3131

3232
let spline = CubicSmoothingSpline::new(&x, &y)
3333
.with_weights(&w)
34-
.with_smooth(0.8)
34+
.with_smoothing(0.8)
3535
.make()
3636
.unwrap();
3737

@@ -55,18 +55,15 @@ fn main() {
5555
let x1 = array![1.0, 2.0, 3.0, 4.0];
5656
let x = vec![x0.view(), x1.view()];
5757

58-
let xi0 = array![1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0];
59-
let xi1 = array![1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0];
60-
let xi = vec![xi0.view(), xi1.view()];
61-
6258
let y = array![
63-
[0.5, 1.2, 3.4, 2.5],
64-
[1.5, 2.2, 4.4, 3.5],
65-
[2.5, 3.2, 5.4, 4.5],
66-
[3.5, 4.2, 6.4, 5.5],
59+
[0.5, 1.2, 3.4, 2.5],
60+
[1.5, 2.2, 4.4, 3.5],
61+
[2.5, 3.2, 5.4, 4.5],
62+
[3.5, 4.2, 6.4, 5.5],
6763
];
6864

6965
let yi = GridCubicSmoothingSpline::new(&x, &y)
66+
.with_smoothing_fill(0.5)
7067
.make().unwrap()
7168
.evaluate(&x).unwrap();
7269

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
//!
6363
//! let yi = CubicSmoothingSpline::new(&x, &y)
6464
//! .with_weights(&w)
65-
//! .with_smooth(0.8)
65+
//! .with_smoothing(0.8)
6666
//! .make().unwrap()
6767
//! .evaluate(&xi).unwrap();
6868
//!

src/ndg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<'a, T, D> GridCubicSmoothingSpline<'a, T, D>
215215
///
216216
/// If the smoothing parameter value is None, it will be computed automatically.
217217
///
218-
pub fn with_smooth(mut self, smooth: &[Option<T>]) -> Self {
218+
pub fn with_smoothing(mut self, smooth: &[Option<T>]) -> Self {
219219
self.invalidate();
220220
self.smooth = smooth.to_vec();
221221
self
@@ -235,7 +235,7 @@ impl<'a, T, D> GridCubicSmoothingSpline<'a, T, D>
235235
/// - 0: The smoothing spline is the least-squares straight line fit to the data
236236
/// - 1: The cubic spline interpolant with natural boundary condition
237237
///
238-
pub fn with_all_smooth(mut self, smooth: T) -> Self {
238+
pub fn with_smoothing_fill(mut self, smooth: T) -> Self {
239239
self.invalidate();
240240
self.smooth = vec![Some(smooth); self.x.len()];
241241
self

src/ndg/make.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<'a, T, D> GridCubicSmoothingSpline<'a, T, D>
3333

3434
let sp = CubicSmoothingSpline::new(x, y)
3535
.with_optional_weights(weights)
36-
.with_optional_smooth(s)
36+
.with_optional_smoothing(s)
3737
.make()?;
3838

3939
smooth[ax] = sp.smooth();

src/umv.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl<'a, T> NdSpline<'a, T>
138138
///
139139
/// let s = CubicSmoothingSpline::new(&x, &y)
140140
/// .with_weights(&w)
141-
/// .with_smooth(smooth)
141+
/// .with_smoothing(smooth)
142142
/// .make().unwrap();
143143
///
144144
/// let xi = array![1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0];
@@ -263,14 +263,14 @@ impl<'a, T, D> CubicSmoothingSpline<'a, T, D>
263263
/// - 0: The smoothing spline is the least-squares straight line fit to the data
264264
/// - 1: The cubic spline interpolant with natural boundary condition
265265
///
266-
pub fn with_smooth(mut self, smooth: T) -> Self {
266+
pub fn with_smoothing(mut self, smooth: T) -> Self {
267267
self.invalidate();
268268
self.smooth = Some(smooth);
269269
self
270270
}
271271

272272
/// Sets the smoothing parameter in `Option` wrap
273-
pub fn with_optional_smooth(mut self, smooth: Option<T>) -> Self {
273+
pub fn with_optional_smoothing(mut self, smooth: Option<T>) -> Self {
274274
self.invalidate();
275275
self.smooth = smooth;
276276
self

tests/umv_full.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn test_with_weights_and_smooth() {
9292

9393
let s = CubicSmoothingSpline::new(&x, &y)
9494
.with_weights(&w)
95-
.with_smooth(0.8)
95+
.with_smoothing(0.8)
9696
.make()
9797
.unwrap();
9898

tests/umv_validate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn test_smooth_less_than_error() {
8585
let s = -0.5;
8686

8787
CubicSmoothingSpline::new(&x, &y)
88-
.with_smooth(s)
88+
.with_smoothing(s)
8989
.make()
9090
.unwrap();
9191
}
@@ -99,7 +99,7 @@ fn test_smooth_greater_than_error() {
9999
let s = 1.5;
100100

101101
CubicSmoothingSpline::new(&x, &y)
102-
.with_smooth(s)
102+
.with_smoothing(s)
103103
.make()
104104
.unwrap();
105105
}

0 commit comments

Comments
 (0)