soco 1.0.0

Algorithms for Smoothed Online Convex Optimization
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::collections::HashMap;

/// Constructs a hash map from a slice.
pub fn hash_map<K, V>(slice: &[(K, V)]) -> HashMap<K, V>
where
    K: Clone + Eq + std::hash::Hash + PartialEq,
    V: Clone,
{
    slice.iter().cloned().collect()
}

/// Selects upper bounds from decision space.
pub fn upper_bounds<T>(bounds: &[(T, T)]) -> Vec<T>
where
    T: Copy,
{
    bounds.iter().map(|&(_, m)| m).collect()
}