pub fn dot_product(vec1: &Vector, vec2: &Vector) -> Option<f64> {
        if Vector::equal_dimensions(&vec1, &vec2) {
            let mut sum: f64 = 0.0;
            for i in 0..vec1.dimension {
                sum += vec1.components[i] * vec2.components[i];
            }
            return Some(sum);
        }
        None
    }
/// Calculates dot product between two vectors
Calculates dot product between two vectors
Calculates dot product between two vectors
pub fn dot_product(vec1: &Vector, vec2: &Vector) -> Option<f64> {
        if Vector::equal_dimensions(&vec1, &vec2) {
            let mut sum: f64 = 0.0;
            for i in 0..vec1.dimension {
                sum += vec1.components[i] * vec2.components[i];
            }
            return Some(sum);
        }
        None
    }
pub fn dot_product ( vec1 : & Vector , vec2 : & Vector ) -> Option < f64 > { if Vector :: equal_dimensions ( & vec1 , & vec2 ) { let mut sum : f64 = 0.0 ; for i in 0 .. vec1 . dimension { sum += vec1 . components [ i ] * vec2 . components [ i ] ; } return Some ( sum ) ; } None }
Calculates dot product between two vectors
Calculates dot product between two vectors
vec1
&Vector
vec2
&Vector
vec1
&Vector
vec2
&Vector