Function russell_lab::vector::vec_inner

source ·
pub fn vec_inner(u: &Vector, v: &Vector) -> f64
Expand description

(ddot) Performs the inner (dot) product between two vectors resulting in a scalar value

 s := u dot v

See also: https://www.netlib.org/lapack/explore-html/d5/df6/ddot_8f.html

§Note

The lengths of both vectors may be different; the smallest length will be selected.

§Examples

use russell_lab::{vec_inner, Vector};
let u = Vector::from(&[1.0, 2.0, 3.0]);
let v = Vector::from(&[5.0, -2.0, 0.0, 1.0]);
let s = vec_inner(&u, &v);
assert_eq!(s, 1.0);