pub fn new(poly: &Abstract, rank: usize, idx: usize) -> Option<Self> {
        poly.get_element(rank, idx)?;

        // A vector of HashMaps. The k-th entry is a map from k-elements of the
        // original polytope into k-elements in a new polytope.
        let mut hashes: Vec<_> = iter::repeat_with(HashMap::new).take(rank + 1).collect();
        hashes[rank].insert(idx, 0);

        // Gets subindices of subindices, until reaching the vertices.
        for r in (1..=rank).rev() {
            let (left_slice, right_slice) = hashes.split_at_mut(r);
            let prev_hash = left_slice.last_mut().unwrap();
            let hash = right_slice.first().unwrap();

            for &idx in hash.keys() {
                for &sub in &poly[(r, idx)].subs {
                    let len = prev_hash.len();
                    prev_hash.entry(sub).or_insert(len);
                }
            }
        }

        Some(Self(hashes))
    }
/// Returns a map from elements on a polytope to elements on a new polytope
/// representing a particular element (as a polytope). If the element
/// doesn't exist, we return `None`.
Returns a map from elements on a polytope to elements on a new polytope
representing a particular element (as a polytope). If the element
doesn't exist, we return `None`.
Returns a map from elements on a polytope to elements on a new polytope representing a particular element ( as a polytope ) . If the element doesn ' t exist we return ` None ` .
pub fn new(poly: &Abstract, rank: usize, idx: usize) -> Option<Self> {
        poly.get_element(rank, idx)?;
        // A vector of HashMaps. The k-th entry is a map from k-elements of the
        // original polytope into k-elements in a new polytope.
        let mut hashes: Vec<_> = iter::repeat_with(HashMap::new).take(rank + 1).collect();
        hashes[rank].insert(idx, 0);
        // Gets subindices of subindices, until reaching the vertices.
        for r in (1..=rank).rev() {
            let (left_slice, right_slice) = hashes.split_at_mut(r);
            let prev_hash = left_slice.last_mut().unwrap();
            let hash = right_slice.first().unwrap();
            for &idx in hash.keys() {
                for &sub in &poly[(r, idx)].subs {
                    let len = prev_hash.len();
                    prev_hash.entry(sub).or_insert(len);
                }
            }
        }
        Some(Self(hashes))
    }
pub fn new ( poly : & Abstract , rank : usize , idx : usize ) -> Option < Self > { poly . get_element ( rank , idx ) ? ; // A vector of HashMaps. The k-th entry is a map from k-elements of the // original polytope into k-elements in a new polytope. let mut hashes : Vec < _ > = iter :: repeat_with ( HashMap :: new ) . take ( rank + 1 ) . collect ( ) ; hashes [ rank ] . insert ( idx , 0 ) ; // Gets subindices of subindices, until reaching the vertices. for r in ( 1 ..= rank ) . rev ( ) { let ( left_slice , right_slice ) = hashes . split_at_mut ( r ) ; let prev_hash = left_slice . last_mut ( ) . unwrap ( ) ; let hash = right_slice . first ( ) . unwrap ( ) ; for & idx in hash . keys ( ) { for & sub in & poly [ ( r , idx ) ] . subs { let len = prev_hash . len ( ) ; prev_hash . entry ( sub ) . or_insert ( len ) ; } } } Some ( Self ( hashes ) ) }
Returns a map from elements on a polytope to elements on a new polytope
representing a particular element (as a polytope).
Returns a map from elements on a polytope to elements on a new polytope representing a particular element ( as a polytope ) .
poly
&Abstract
rank
usize
idx
usize
poly
&Abstract
rank
usize
idx
usize