Skip to content

Commit 6587ac0

Browse files
committed
Rename to from_array
1 parent 49487bc commit 6587ac0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/linalg/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ pub trait BaseVector<T: RealNumber>: Clone + Debug {
8686
/// Create a new vector from a &[T]
8787
/// ```
8888
/// use smartcore::linalg::naive::dense_matrix::*;
89-
/// let slice: &[f64] = &[0., 0.5, 2., 3., 4.];
90-
/// let a: Vec<f64> = BaseVector::from_slice(slice);
91-
/// assert_eq!(a, vec![0., 0.5, 2., 3., 4.]);
89+
/// let a: [f64; 5] = [0., 0.5, 2., 3., 4.];
90+
/// let v: Vec<f64> = BaseVector::from_array(&a);
91+
/// assert_eq!(v, vec![0., 0.5, 2., 3., 4.]);
9292
/// ```
93-
fn from_slice(f: &[T]) -> Self {
93+
fn from_array(f: &[T]) -> Self {
9494
let mut v = Self::zeros(f.len());
9595
for (i, elem) in f.iter().enumerate() {
9696
v.set(i, *elem);

src/naive_bayes/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<T: RealNumber, M: Matrix<T>, D: NBDistribution<T, M>> BaseNaiveBayes<T, M,
5858
*prediction
5959
})
6060
.collect::<Vec<T>>();
61-
let y_hat = M::RowVector::from_slice(&predictions);
61+
let y_hat = M::RowVector::from_array(&predictions);
6262
Ok(y_hat)
6363
}
6464
}

0 commit comments

Comments
 (0)