MCPcopy Create free account
hub / github.com/douchuan/algorithm / magnitude

Method magnitude

src/math/sparse_vector.rs:76–78  ·  view source on GitHub ↗

Returns the magnitude of this vector. This is also known as the L2 norm or the Euclidean norm.

(&self)

Source from the content-addressed store, hash-verified

74 /// Returns the magnitude of this vector.
75 /// This is also known as the L2 norm or the Euclidean norm.
76 pub fn magnitude(&self) -> f64 {
77 self.dot(self).unwrap().sqrt()
78 }
79
80 /// Returns the scalar-vector product of this vector with the specified scalar.
81 pub fn scale(&self, alpha: f64) -> Self {

Callers

nothing calls this directly

Calls 1

dotMethod · 0.80

Tested by

no test coverage detected