Main page.

Declarations of functions associated with group_E.
Version of Wednesday 11 September 2024.


All of the following rearrange elements in one way or another. Each _modify function changes the value of *this, while each _create leaves *this unchanged, returning a new permzbi with the new value. In general, a _modify will run faster than a _create, mainly because each _create invokes a _modify.

Implementation note: When begin == 0, it refers to the begin() iterator of the permzbi's underlying SVI; when end == −1, it refers to the end() iterator.

    /* E1 */ permzbi & reverse_by_index_modify (int begin = 0, int end = -1);
    /* E1 */ permzbi   reverse_by_index_create (int begin = 0, int end = -1) const;
    /* E1 */ permzbi & reverse_by_value_modify (int begin = 0, int end = -1);
    /* E1 */ permzbi   reverse_by_value_create (int begin = 0, int end = -1) const;

For any permzbi P,

P.reverse_by_value_create();
is equivalent to
P.inverse().reverse_by_index_create().inverse();

and

P.reverse_by_index_create();
is equivalent to
P.inverse().reverse_by_value_create().inverse();

This illustrates the dual nature of indices and values. Within each equivalent pair, the shorter version will probably be faster. A similar comment applies to all the functions on this page.

    /* E2 */ permzbi & swap_by_index_modify (int ind_beg_1, int ind_beg_2, int const dist = 1);
    /* E2 */ permzbi   swap_by_index_create (int ind_beg_1, int ind_beg_2, int const dist = 1) const;
    /* E2 */ permzbi & swap_by_value_modify (int val_beg_1, int val_beg_2, int const dist = 1);
    /* E2 */ permzbi   swap_by_value_create (int val_beg_1, int val_beg_2, int const dist = 1) const;
    /* E3 */ permzbi & rotate_by_index_modify (int dist, int begin = 0, int end = -1);
    /* E3 */ permzbi   rotate_by_index_create (int dist, int begin = 0, int end = -1) const;
    /* E3 */ permzbi & rotate_by_value_modify (int dist, int begin = 0, int end = -1);
    /* E3 */ permzbi   rotate_by_value_create (int dist, int begin = 0, int end = -1) const;
    /* E4 */ permzbi & scramble_tight_by_index_modify (int factor);
    /* E4 */ permzbi   scramble_tight_by_index_create (int factor) const; 
    /* E4 */ permzbi & scramble_tight_by_value_modify (int factor); 
    /* E4 */ permzbi   scramble_tight_by_value_create (int factor) const; 
    /* E4 */ permzbi & scramble_loose_by_index_modify (int factor); 
    /* E4 */ permzbi   scramble_loose_by_index_create (int factor) const; 
    /* E4 */ permzbi & scramble_loose_by_value_modify (int factor); 
    /* E4 */ permzbi   scramble_loose_by_value_create (int factor) const; 

Each scramble_tight_ function requires that the greatest common divisor of the factor and the permzbi size equal one. By contrast, each scramble_loose_ function does not, shifting components to someplace that they will fit. The implementation of scramble_tight_ is much simpler (and presumably faster) than that of scramble_loose_.