Returns the magnitude of this vector. This is also known as the L2 norm or the Euclidean norm.
(&self)
| 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 { |