Skip to content

Commit

Permalink
Add explicit constructor for CuPoint, fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
hacatu committed Feb 20, 2024
1 parent 512c4b4 commit d19c5f4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
target/
*.profdata
*.profraw
*.profraw
*.skip
8 changes: 7 additions & 1 deletion src/cuboid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ impl<T: Ord + Clone + NumRef, const N: usize> KdPoint for CuPoint<T, N> {
}
}

impl<T: Ord + Clone + NumRef, const N: usize> From<[T; N]> for CuPoint<T, N> {
fn from(value: [T; N]) -> Self {
Self{buf: value}
}
}

/// Generate a random point in a square/cube/etc.
/// Given a Uniform distribution sampling from a range, this adds the ability to
/// randomly generate CuPoints whose coordinates are iid (independent and identically distributed)
Expand Down Expand Up @@ -117,7 +123,7 @@ impl<T: Ord + Copy + NumRef, const N: usize> Copy for CuRegion<T, N> {}
mod tests {
use rand::distributions::{Distribution, Uniform};

use crate::kdree::KdTree;
use crate::kdtree::KdTree;

use super::*;

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

pub mod mmheap;
pub mod cuboid;
pub mod kdree;
pub mod kdtree;

use std::cmp::Ordering;

Expand Down

0 comments on commit d19c5f4

Please sign in to comment.