Converts the contained map into a vector of tuples of (flat_point_index, density)
(&self)
| 268 | impl<'a, I: Index, R: Real> DensityMap<'a, I, R> { |
| 269 | /// Converts the contained map into a vector of tuples of (flat_point_index, density) |
| 270 | pub fn to_vec(&self) -> Vec<(I, R)> { |
| 271 | match self { |
| 272 | DensityMap::Standard(map) => map.iter().map(|(&i, &r)| (i, r)).collect(), |
| 273 | DensityMap::DashMap(map) => map.iter().map(|(&i, &r)| (i, r)).collect(), |
| 274 | DensityMap::Dense(values) => values |
| 275 | .iter() |
| 276 | .copied() |
| 277 | .enumerate() |
| 278 | .map(|(i, r)| (I::from_usize(i).unwrap(), r)) |
| 279 | .collect(), |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | /// Returns the number of density entries |
| 284 | pub fn len(&self) -> usize { |