section 6E
X_lens_caten

home

Classes var_lens_caten and con_lens_caten cause two matrices to appear to be combined into one. These lenses are smart enough to infer in which subscript position the catenation should take place, thus it need not be separately specified. As with all lenses, construction of a X_lens_caten does not alter the underlying matrices.

If check is true, these constraints will be verified; if false, behavior of an erroneous program will be unpredictable.

For example, this program:

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

int main () {
    form const frm_a {blt{3,6},blt{2,4},blt{2,5}};
    cout << "\nfrm_a: " << frm_a;
    var_matrix<double> mat_a {sub_matrix_linear (frm_a, 1.0)};
    cout << "\nmat_a: " << mat_a;

    form const frm_b {blt{3,6},blt{4,6},blt{2,5}};
    cout << "\nfrm_b: " << frm_b;
    con_matrix<double> mat_b {sub_matrix_linear (frm_b, 2.0)};
    cout << "\nmat_b: " << mat_b;

    con_lens_caten<double> vac_c {mat_a, mat_b};
    cout << "\nfrm_c: " << vac_c.get_form();
    cout << "\nvac_c: " << vac_c;

    return 0;
}
yields this output:
frm_a: ( 3 =< 6, 2 =< 4, 2 =< 5 )
mat_a: 
    ( 3 2 2 ) = 1.322    ( 3 2 3 ) = 1.323    ( 3 2 4 ) = 1.324
    ( 3 3 2 ) = 1.332    ( 3 3 3 ) = 1.333    ( 3 3 4 ) = 1.334
    ( 4 2 2 ) = 1.422    ( 4 2 3 ) = 1.423    ( 4 2 4 ) = 1.424
    ( 4 3 2 ) = 1.432    ( 4 3 3 ) = 1.433    ( 4 3 4 ) = 1.434
    ( 5 2 2 ) = 1.522    ( 5 2 3 ) = 1.523    ( 5 2 4 ) = 1.524
    ( 5 3 2 ) = 1.532    ( 5 3 3 ) = 1.533    ( 5 3 4 ) = 1.534
frm_b: ( 3 =< 6, 4 =< 6, 2 =< 5 )
mat_b: 
    ( 3 4 2 ) = 2.342    ( 3 4 3 ) = 2.343    ( 3 4 4 ) = 2.344
    ( 3 5 2 ) = 2.352    ( 3 5 3 ) = 2.353    ( 3 5 4 ) = 2.354
    ( 4 4 2 ) = 2.442    ( 4 4 3 ) = 2.443    ( 4 4 4 ) = 2.444
    ( 4 5 2 ) = 2.452    ( 4 5 3 ) = 2.453    ( 4 5 4 ) = 2.454
    ( 5 4 2 ) = 2.542    ( 5 4 3 ) = 2.543    ( 5 4 4 ) = 2.544
    ( 5 5 2 ) = 2.552    ( 5 5 3 ) = 2.553    ( 5 5 4 ) = 2.554
frm_c: ( 3 =< 6, 2 =< 6, 2 =< 5 )
vac_c: 
    ( 3 2 2 ) = 1.322    ( 3 2 3 ) = 1.323    ( 3 2 4 ) = 1.324
    ( 3 3 2 ) = 1.332    ( 3 3 3 ) = 1.333    ( 3 3 4 ) = 1.334
    ( 3 4 2 ) = 2.342    ( 3 4 3 ) = 2.343    ( 3 4 4 ) = 2.344
    ( 3 5 2 ) = 2.352    ( 3 5 3 ) = 2.353    ( 3 5 4 ) = 2.354
    ( 4 2 2 ) = 1.422    ( 4 2 3 ) = 1.423    ( 4 2 4 ) = 1.424
    ( 4 3 2 ) = 1.432    ( 4 3 3 ) = 1.433    ( 4 3 4 ) = 1.434
    ( 4 4 2 ) = 2.442    ( 4 4 3 ) = 2.443    ( 4 4 4 ) = 2.444
    ( 4 5 2 ) = 2.452    ( 4 5 3 ) = 2.453    ( 4 5 4 ) = 2.454
    ( 5 2 2 ) = 1.522    ( 5 2 3 ) = 1.523    ( 5 2 4 ) = 1.524
    ( 5 3 2 ) = 1.532    ( 5 3 3 ) = 1.533    ( 5 3 4 ) = 1.534
    ( 5 4 2 ) = 2.542    ( 5 4 3 ) = 2.543    ( 5 4 4 ) = 2.544
    ( 5 5 2 ) = 2.552    ( 5 5 3 ) = 2.553    ( 5 5 4 ) = 2.554