Home page.


Here is an example of the laminate function. Given these statements:

    permu_arr_0<5> const a {3, 4, 2, 0, 1};
    permu_arr_0<4> const b {1, 2, 0, 3};
    permu_arr_0<5*4> const c {a.laminate (b)};
the elements of c are
    c: [  8  9  7  5  6 13 14 12 10 11  3  4  2  0  1 18 19 17 15 16 ]

The following table shows in detail how this is calculated:

8 = 3 + 1 × 5 9 = 4 + 1 × 5 7 = 2 + 1 × 5 5 = 0 + 1 × 5 6 = 1 + 1 × 5
13 = 3 + 2 × 5 14 = 4 + 2 × 5 12 = 2 + 2 × 5 10 = 0 + 2 × 5 11 = 1 + 2 × 5
3 = 3 + 0 × 5 4 = 4 + 0 × 5 2 = 2 + 0 × 5 0 = 0 + 0 × 5 1 = 1 + 0 × 5
18 = 3 + 3 × 5 19 = 4 + 3 × 5 17 = 2 + 3 × 5 15 = 0 + 3 × 5 16 = 1 + 3 × 5

Lamination is not commutative. Given the following statement:

    permu_arr_0<4*5> const d {b.laminate (a)};
the elements of d are:
    d: [ 13 14 12 15 17 18 16 19  9 10  8 11  1  2  0  3  5  6  4  7 ]
The statement constructing d could also have been written this way:
    permu_arr_0<b.size()*a.size()> const d {b.laminate (a)};

Following is the equivalent for a one-based array. Given these statements:

    permu_arr_1<5> const e {4, 5, 3, 1, 2};
    permu_arr_1<4> const f {2, 3, 1, 4};
    permu_arr_1<5*4> const g {e.laminate (f)};
the elements of g are
    g: [  9 10  8  6  7 14 15 13 11 12  4  5  3  1  2 19 20 18 16 17 ]

Here is an example of how lamination sometimes amounts to repeated applications of direct_sum and skew_sum. Given these statements:

    permu_arr_0<10> const h {a.direct_sum (a)};
    permu_arr_0<15> const i {h.skew_sum (a)};
    permu_arr_0<20> const j {i.direct_sum (a)};
the elements of g, h, and i are:
    h: [  3  4  2  0  1  8  9  7  5  6  ] 
    i: [  8  9  7  5  6 13 14 12 10 11  3  4  2  0  1  ] 
    j: [  8  9  7  5  6 13 14 12 10 11  3  4  2  0  1 18 19 17 15 16 ] 
where j equals c above.

Consider the expression a.laminate(b). If b.separable() is true, a decomposition of the result into direct and skew sums as above will be possible.