Skip to content

Commit

Permalink
fix rustdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Jul 6, 2024
1 parent 02b4e39 commit 621e1cf
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 50 deletions.
4 changes: 1 addition & 3 deletions src/pav.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ mod point;
mod isotonic_regression;

pub use coordinate::Coordinate;
pub use point::Point;
pub use isotonic_regression::IsotonicRegression;
pub use isotonic_regression::IsotonicRegressionError;
pub use point::Point;
94 changes: 47 additions & 47 deletions src/pav/isotonic_regression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ impl<T: Coordinate> IsotonicRegression<T> {
/// ```
///
/// let points = vec![
/// crate::point::Point::new(0.0, 1.0),
/// crate::point::Point::new(1.0, 2.0),
/// crate::point::Point::new(2.0, 1.5),
/// crate::point::Point::new(3.0, 3.0),
/// super::point::Point::new(0.0, 1.0),
/// super::point::Point::new(1.0, 2.0),
/// super::point::Point::new(2.0, 1.5),
/// super::point::Point::new(3.0, 3.0),
/// ];
/// let regression = crate::isotonic_regression::IsotonicRegression::new_ascending(&points).unwrap();
/// let regression = super::isotonic_regression::IsotonicRegression::new_ascending(&points).unwrap();
/// assert_eq!(regression.get_points().len(), 3);
/// ```
pub fn new_ascending(points: &[Point<T>]) -> Result<IsotonicRegression<T>, IsotonicRegressionError> {
Expand All @@ -83,12 +83,12 @@ impl<T: Coordinate> IsotonicRegression<T> {
///
/// ```
/// let points = vec![
/// crate::point::Point::new(0.0, 3.0),
/// crate::point::Point::new(1.0, 2.0),
/// crate::point::Point::new(2.0, 2.5),
/// crate::point::Point::new(3.0, 1.0),
/// super::point::Point::new(0.0, 3.0),
/// super::point::Point::new(1.0, 2.0),
/// super::point::Point::new(2.0, 2.5),
/// super::point::Point::new(3.0, 1.0),
/// ];
/// let regression = crate::isotonic_regression::IsotonicRegression::new_descending(&points).unwrap();
/// let regression = super::isotonic_regression::IsotonicRegression::new_descending(&points).unwrap();
/// assert_eq!(regression.get_points().len(), 3);
/// ```
pub fn new_descending(points: &[Point<T>]) -> Result<IsotonicRegression<T>, IsotonicRegressionError> {
Expand All @@ -103,12 +103,12 @@ impl<T: Coordinate> IsotonicRegression<T> {
///
/// ```
/// let points = vec![
/// crate::point::Point::new(0.0, 1.0),
/// crate::point::Point::new(1.0, 2.0),
/// crate::point::Point::new(2.0, 1.5),
/// crate::point::Point::new(3.0, 3.0),
/// super::point::Point::new(0.0, 1.0),
/// super::point::Point::new(1.0, 2.0),
/// super::point::Point::new(2.0, 1.5),
/// super::point::Point::new(3.0, 3.0),
/// ];
/// let regression = crate::isotonic_regression::IsotonicRegression::new(&points, crate::isotonic_regression::Direction::Ascending, false).unwrap();
/// let regression = super::isotonic_regression::IsotonicRegression::new(&points, super::isotonic_regression::Direction::Ascending, false).unwrap();
/// assert_eq!(regression.get_points().len(), 3);
/// ```
fn new(points: &[Point<T>], direction: Direction, intersect_origin: bool) -> Result<IsotonicRegression<T>, IsotonicRegressionError> {
Expand Down Expand Up @@ -140,12 +140,12 @@ impl<T: Coordinate> IsotonicRegression<T> {
///
/// ```
/// let points = vec![
/// crate::point::Point::new(0.0, 1.0),
/// crate::point::Point::new(1.0, 2.0),
/// crate::point::Point::new(2.0, 1.5),
/// crate::point::Point::new(3.0, 3.0),
/// super::point::Point::new(0.0, 1.0),
/// super::point::Point::new(1.0, 2.0),
/// super::point::Point::new(2.0, 1.5),
/// super::point::Point::new(3.0, 3.0),
/// ];
/// let regression = crate::isotonic_regression::IsotonicRegression::new_ascending(&points).unwrap();
/// let regression = super::isotonic_regression::IsotonicRegression::new_ascending(&points).unwrap();
/// let interpolated_y = regression.interpolate(1.5).unwrap();
/// assert_eq!(interpolated_y, 1.75);
/// ```
Expand Down Expand Up @@ -200,12 +200,12 @@ impl<T: Coordinate> IsotonicRegression<T> {
///
/// ```
/// let points = vec![
/// crate::point::Point::new(0.0, 1.0),
/// crate::point::Point::new(1.0, 2.0),
/// crate::point::Point::new(2.0, 1.5),
/// crate::point::Point::new(3.0, 3.0),
/// super::point::Point::new(0.0, 1.0),
/// super::point::Point::new(1.0, 2.0),
/// super::point::Point::new(2.0, 1.5),
/// super::point::Point::new(3.0, 3.0),
/// ];
/// let regression = crate::isotonic_regression::IsotonicRegression::new_ascending(&points).unwrap();
/// let regression = super::isotonic_regression::IsotonicRegression::new_ascending(&points).unwrap();
/// assert_eq!(regression.get_points().len(), 3);
/// ```
pub fn get_points(&self) -> &[Point<T>] {
Expand All @@ -218,12 +218,12 @@ impl<T: Coordinate> IsotonicRegression<T> {
///
/// ```
/// let points = vec![
/// crate::point::Point::new(0.0, 1.0),
/// crate::point::Point::new(1.0, 2.0),
/// crate::point::Point::new(2.0, 1.5),
/// crate::point::Point::new(3.0, 3.0),
/// super::point::Point::new(0.0, 1.0),
/// super::point::Point::new(1.0, 2.0),
/// super::point::Point::new(2.0, 1.5),
/// super::point::Point::new(3.0, 3.0),
/// ];
/// let regression = crate::isotonic_regression::IsotonicRegression::new_ascending(&points).unwrap();
/// let regression = super::isotonic_regression::IsotonicRegression::new_ascending(&points).unwrap();
/// let centroid = regression.get_centroid_point().unwrap();
/// assert_eq!(*centroid.x(), 1.0);
/// assert_eq!(*centroid.y(), 1.875);
Expand All @@ -245,11 +245,11 @@ impl<T: Coordinate> IsotonicRegression<T> {
/// # Examples
///
/// ```
/// let mut regression = crate::isotonic_regression::IsotonicRegression::new_ascending(&[
/// crate::point::Point::new(0.0, 1.0),
/// crate::point::Point::new(2.0, 2.0),
/// let mut regression = super::isotonic_regression::IsotonicRegression::new_ascending(&[
/// super::point::Point::new(0.0, 1.0),
/// super::point::Point::new(2.0, 2.0),
/// ]).unwrap();
/// regression.add_points(&[Point::new(1.0, 1.5)]);
/// regression.add_points(&[super::Point::new(1.0, 1.5)]);
/// assert_eq!(regression.get_points().len(), 3);
/// ```
pub fn add_points(&mut self, points: &[Point<T>]) {
Expand All @@ -272,12 +272,12 @@ impl<T: Coordinate> IsotonicRegression<T> {
/// # Examples
///
/// ```
/// let mut regression = crate::isotonic_regression::IsotonicRegression::new_ascending(&[
/// crate::point::Point::new(0.0, 1.0),
/// crate::point::Point::new(1.0, 2.0),
/// crate::point::Point::new(2.0, 3.0),
/// let mut regression = super::isotonic_regression::IsotonicRegression::new_ascending(&[
/// super::point::Point::new(0.0, 1.0),
/// super::point::Point::new(1.0, 2.0),
/// super::point::Point::new(2.0, 3.0),
/// ]).unwrap();
/// regression.remove_points(&[Point::new(1.0, 2.0)]);
/// regression.remove_points(&[super::Point::new(1.0, 2.0)]);
/// assert_eq!(regression.get_points().len(), 2);
/// ```
pub fn remove_points(&mut self, points: &[Point<T>]) {
Expand All @@ -303,16 +303,16 @@ impl<T: Coordinate> IsotonicRegression<T> {
/// # Examples
///
/// ```
/// use crate::point::Point;
/// use crate::isotonic_regression::IsotonicRegression;
/// use super::point::Point;
/// use super::isotonic_regression::IsotonicRegression;
///
/// let points = vec![
/// Point::new(0.0, 1.0),
/// Point::new(1.0, 2.0),
/// Point::new(2.0, 1.5),
/// Point::new(3.0, 3.0),
/// super::Point::new(0.0, 1.0),
/// super::Point::new(1.0, 2.0),
/// super::Point::new(2.0, 1.5),
/// super::Point::new(3.0, 3.0),
/// ];
/// let regression = IsotonicRegression::new_ascending(&points).unwrap();
/// let regression = super::IsotonicRegression::new_ascending(&points).unwrap();
/// assert_eq!(regression.len(), 4);
/// ```
pub fn len(&self) -> usize {
Expand All @@ -324,7 +324,7 @@ impl<T: Coordinate> IsotonicRegression<T> {
/// # Examples
///
/// ```
/// let regression: crate::isotonic_regression::IsotonicRegression<f64> = crate::isotonic_regression::IsotonicRegression::new_ascending(&[]).unwrap();
/// let regression: super::isotonic_regression::IsotonicRegression<f64> = super::isotonic_regression::IsotonicRegression::new_ascending(&[]).unwrap();
/// assert!(regression.is_empty());
/// ```
#[must_use]
Expand Down

0 comments on commit 621e1cf

Please sign in to comment.