section 6D
X_lens_permu_body

home

Classes var_lens_permu_body and con_lens_permu_body appear to rearrange the components of the underlying matrix according to a permutation of one subscript. The form does not appear to be changed. This example permutes the first subscript, and then the last subscript:

#include "SOME_DIRECTORY/mat_gen_dim.h"
using namespace mat_gen_dim;

int main () {
    permu const per0 {1, 2, 0};
    permu const per2 {2, 1, 0, 3};

    form const frm_a {blt{2,5},blt{1,3},blt{4,8}};
    cout << "\nfrm_a: " << frm_a;
    var_matrix<double> mat_a {sub_matrix_linear (frm_a,5.0)};
    cout << "\nmat_a: " << mat_a;

    var_lens_permu_body<double> aof_b {mat_a, per0, 0};
    cout << "\naof_b: " << aof_b;

    con_lens_permu_body<double> aof_c {aof_b, per2, 2};
    cout << "\naof_c: " << aof_c;

    cout << "\nmat_a (3 1 6) = " << mat_a.get (vec_si {3,1,6});
    cout << "\naof_b (2 1 6) = " << aof_b.get (vec_si {2,1,6});
    cout << "\naof_c (2 1 4) = " << aof_c.get (vec_si {2,1,4});

    return 0;
}
yields this result:
frm_a: ( 2 =< 5, 1 =< 3, 4 =< 8 )
mat_a: 
    ( 2 1 4 ) = 5.214    ( 2 1 5 ) = 5.215    ( 2 1 6 ) = 5.216    ( 2 1 7 ) = 5.217
    ( 2 2 4 ) = 5.224    ( 2 2 5 ) = 5.225    ( 2 2 6 ) = 5.226    ( 2 2 7 ) = 5.227
    ( 3 1 4 ) = 5.314    ( 3 1 5 ) = 5.315    ( 3 1 6 ) = 5.316    ( 3 1 7 ) = 5.317
    ( 3 2 4 ) = 5.324    ( 3 2 5 ) = 5.325    ( 3 2 6 ) = 5.326    ( 3 2 7 ) = 5.327
    ( 4 1 4 ) = 5.414    ( 4 1 5 ) = 5.415    ( 4 1 6 ) = 5.416    ( 4 1 7 ) = 5.417
    ( 4 2 4 ) = 5.424    ( 4 2 5 ) = 5.425    ( 4 2 6 ) = 5.426    ( 4 2 7 ) = 5.427
aof_b: 
    ( 2 1 4 ) = 5.314    ( 2 1 5 ) = 5.315    ( 2 1 6 ) = 5.316    ( 2 1 7 ) = 5.317
    ( 2 2 4 ) = 5.324    ( 2 2 5 ) = 5.325    ( 2 2 6 ) = 5.326    ( 2 2 7 ) = 5.327
    ( 3 1 4 ) = 5.414    ( 3 1 5 ) = 5.415    ( 3 1 6 ) = 5.416    ( 3 1 7 ) = 5.417
    ( 3 2 4 ) = 5.424    ( 3 2 5 ) = 5.425    ( 3 2 6 ) = 5.426    ( 3 2 7 ) = 5.427
    ( 4 1 4 ) = 5.214    ( 4 1 5 ) = 5.215    ( 4 1 6 ) = 5.216    ( 4 1 7 ) = 5.217
    ( 4 2 4 ) = 5.224    ( 4 2 5 ) = 5.225    ( 4 2 6 ) = 5.226    ( 4 2 7 ) = 5.227
aof_c: 
    ( 2 1 4 ) = 5.316    ( 2 1 5 ) = 5.315    ( 2 1 6 ) = 5.314    ( 2 1 7 ) = 5.317
    ( 2 2 4 ) = 5.326    ( 2 2 5 ) = 5.325    ( 2 2 6 ) = 5.324    ( 2 2 7 ) = 5.327
    ( 3 1 4 ) = 5.416    ( 3 1 5 ) = 5.415    ( 3 1 6 ) = 5.414    ( 3 1 7 ) = 5.417
    ( 3 2 4 ) = 5.426    ( 3 2 5 ) = 5.425    ( 3 2 6 ) = 5.424    ( 3 2 7 ) = 5.427
    ( 4 1 4 ) = 5.216    ( 4 1 5 ) = 5.215    ( 4 1 6 ) = 5.214    ( 4 1 7 ) = 5.217
    ( 4 2 4 ) = 5.226    ( 4 2 5 ) = 5.225    ( 4 2 6 ) = 5.224    ( 4 2 7 ) = 5.227
mat_a (3 1 6) = 5.316
aof_b (2 1 6) = 5.316
aof_c (2 1 4) = 5.316