section 6C
X_lens_permu_form

home

Classes var_lens_permu_form and con_lens_permu_form appear to permute the blts residing within the form of the underlying matrix; subscripts must be correspondingly permuted. This is a generalization of the notion of transposing a matrix. For example, this program:

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

int main () {
    permu const per {1, 2, 0};

    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, 6.0)};
    cout << "\nmat_a: " << mat_a;

    var_lens_permu_form<double> aof_b {mat_a, per};
    cout << "\nfrm_b: " << aof_b.get_form();
    cout << "\naof_b: " << aof_b;

    con_lens_permu_form<double> aof_c {aof_b, per};
    cout << "\nfrm_c: " << aof_c.get_form();
    cout << "\naof_c: " << aof_c;

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

    return 0;
}
gives this output:
frm_a: ( 2 =< 5, 1 =< 3, 4 =< 8 )
mat_a: 
    ( 2 1 4 ) = 6.214    ( 2 1 5 ) = 6.215    ( 2 1 6 ) = 6.216    ( 2 1 7 ) = 6.217
    ( 2 2 4 ) = 6.224    ( 2 2 5 ) = 6.225    ( 2 2 6 ) = 6.226    ( 2 2 7 ) = 6.227
    ( 3 1 4 ) = 6.314    ( 3 1 5 ) = 6.315    ( 3 1 6 ) = 6.316    ( 3 1 7 ) = 6.317
    ( 3 2 4 ) = 6.324    ( 3 2 5 ) = 6.325    ( 3 2 6 ) = 6.326    ( 3 2 7 ) = 6.327
    ( 4 1 4 ) = 6.414    ( 4 1 5 ) = 6.415    ( 4 1 6 ) = 6.416    ( 4 1 7 ) = 6.417
    ( 4 2 4 ) = 6.424    ( 4 2 5 ) = 6.425    ( 4 2 6 ) = 6.426    ( 4 2 7 ) = 6.427
frm_b: ( 1 =< 3, 4 =< 8, 2 =< 5 )
aof_b: 
    ( 1 4 2 ) = 6.214    ( 1 4 3 ) = 6.314    ( 1 4 4 ) = 6.414
    ( 1 5 2 ) = 6.215    ( 1 5 3 ) = 6.315    ( 1 5 4 ) = 6.415
    ( 1 6 2 ) = 6.216    ( 1 6 3 ) = 6.316    ( 1 6 4 ) = 6.416
    ( 1 7 2 ) = 6.217    ( 1 7 3 ) = 6.317    ( 1 7 4 ) = 6.417
    ( 2 4 2 ) = 6.224    ( 2 4 3 ) = 6.324    ( 2 4 4 ) = 6.424
    ( 2 5 2 ) = 6.225    ( 2 5 3 ) = 6.325    ( 2 5 4 ) = 6.425
    ( 2 6 2 ) = 6.226    ( 2 6 3 ) = 6.326    ( 2 6 4 ) = 6.426
    ( 2 7 2 ) = 6.227    ( 2 7 3 ) = 6.327    ( 2 7 4 ) = 6.427
frm_c: ( 4 =< 8, 2 =< 5, 1 =< 3 )
aof_c: 
    ( 4 2 1 ) = 6.214    ( 4 2 2 ) = 6.224    ( 4 3 1 ) = 6.314    ( 4 3 2 ) = 6.324
    ( 4 4 1 ) = 6.414    ( 4 4 2 ) = 6.424    ( 5 2 1 ) = 6.215    ( 5 2 2 ) = 6.225
    ( 5 3 1 ) = 6.315    ( 5 3 2 ) = 6.325    ( 5 4 1 ) = 6.415    ( 5 4 2 ) = 6.425
    ( 6 2 1 ) = 6.216    ( 6 2 2 ) = 6.226    ( 6 3 1 ) = 6.316    ( 6 3 2 ) = 6.326
    ( 6 4 1 ) = 6.416    ( 6 4 2 ) = 6.426    ( 7 2 1 ) = 6.217    ( 7 2 2 ) = 6.227
    ( 7 3 1 ) = 6.317    ( 7 3 2 ) = 6.327    ( 7 4 1 ) = 6.417    ( 7 4 2 ) = 6.427
mat_a (3 1 6) = 6.316
aof_b (1 6 3) = 6.316
aof_c (6 3 1) = 6.316
In this example, the same permutation is applied twice, giving a different result each time because the effect accumulates. By contrast, the effect of X_lens_other_form does not accumulate.