Performs scalar multiplication of a vector stored in the storage. The vector is identified by its key (ID). The function returns the result of the scalar multiplication as a new vector. # Arguments `key` - The key (ID) of the vector to be scaled. `scalar` - The scalar value by which the vector is to be multiplied. # Returns An `Option` containing the result of the vector scaling as a new vect
(&self, key: &str, scalar: f32)
| 388 | /// assert_eq!(result, Some(vec![2.0, 4.0, 6.0])); |
| 389 | /// ``` |
| 390 | pub fn vector_scaling(&self, key: &str, scalar: f32) -> Option<Vector> { |
| 391 | let v = self.vcache.get(key)?; |
| 392 | let v = v.0.iter().map(|x| x * scalar).collect(); |
| 393 | return Some(Vector(v)) |
| 394 | } |
| 395 | |
| 396 | |
| 397 |
no test coverage detected