Skip to content

Commit ed6e650

Browse files
committed
add optional weights and smooth setters to public api
1 parent de381c4 commit ed6e650

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/umv.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl<'a, T, D> CubicSmoothingSpline<'a, T, D>
225225
self
226226
}
227227

228-
/// Sets the data weights
228+
/// Sets the weights data vector
229229
///
230230
/// `weights.len()` must be equal to `x.len()`
231231
///
@@ -237,13 +237,15 @@ impl<'a, T, D> CubicSmoothingSpline<'a, T, D>
237237
self
238238
}
239239

240-
pub(crate) fn with_optional_weights<W>(mut self, weights: Option<W>) -> Self
240+
/// Sets the weights data vector in `Option` wrap
241+
///
242+
/// `weights.len()` must be equal to `x.len()`
243+
///
244+
pub fn with_optional_weights<W>(mut self, weights: Option<W>) -> Self
241245
where W: AsArray<'a, T>
242246
{
243-
let weights = weights.map(|w| w.into());
244-
245247
self.invalidate();
246-
self.weights = weights;
248+
self.weights = weights.map(|w| w.into());
247249
self
248250
}
249251

@@ -261,7 +263,8 @@ impl<'a, T, D> CubicSmoothingSpline<'a, T, D>
261263
self
262264
}
263265

264-
pub(crate) fn with_optional_smooth(mut self, smooth: Option<T>) -> Self {
266+
/// Sets the smoothing parameter in `Option` wrap
267+
pub fn with_optional_smooth(mut self, smooth: Option<T>) -> Self {
265268
self.invalidate();
266269
self.smooth = smooth;
267270
self

0 commit comments

Comments
 (0)