use ndarray::{arr1, Array1};
#[derive(Clone,Debug)]
pub struct VectorContainer {
pub vector: Array1<f64>,
pub name: String,
}
impl VectorContainer {
pub fn new(vector: Vec<f64>, name: String) -> VectorContainer {
VectorContainer {
vector: arr1(&vector),
name,
}
}
}
impl VectorContainer {
pub fn get_vector(&self) -> &Array1<f64> {
&self.vector
}
pub fn similarity(&self, other: &Array1<f64>) -> f64 {
self.vector.dot(other)
}
}