Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyxu committed Sep 14, 2023
1 parent cde4081 commit 1014133
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 3 additions & 4 deletions rust/lance-linalg/src/distance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@ impl TryFrom<&str> for DistanceType {
"l2" | "euclidean" => Ok(Self::L2),
"cosine" => Ok(Self::Cosine),
"dot" => Ok(Self::Dot),
_ => Err(ArrowError::InvalidArgumentError(
format!("Metric type '{s}' is not supported,")
+ "only 'l2'/'euclidean, 'cosine', and 'dot' are supported.",
)),
_ => Err(ArrowError::InvalidArgumentError(format!(
"Metric type '{s}' is not supported"
))),
}
}
}
6 changes: 4 additions & 2 deletions rust/lance-linalg/src/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ where
mod tests {
use std::collections::HashSet;

use arrow_array::Float32Array;

#[cfg(feature = "opq")]
use approx::assert_relative_eq;

Expand Down Expand Up @@ -337,13 +339,13 @@ mod tests {
fn test_dot_on_transposed_mat() {
// A[2,3]
let a_data = Arc::new(Float32Array::from_iter((1..=6).map(|v| v as f32)));
let a = MatrixView::new(a_data, 3);
let a = MatrixView::<Float32Array>::new(a_data, 3);

// B[3,2]
let b_data = Arc::new(Float32Array::from_iter_values([
2.0, 3.0, 6.0, 7.0, 10.0, 11.0,
]));
let b = MatrixView::new(b_data, 2);
let b = MatrixView::<Float32Array>::new(b_data, 2);

let c_t = b.transpose().dot(&a.transpose()).unwrap();
let expected = vec![44.0, 98.0, 50.0, 113.0];
Expand Down

0 comments on commit 1014133

Please sign in to comment.