operator: matrix

    description:
        matrix[opn, ..., op2, op1]
        matrix[opn, ..., op2, op1] sp
        maps operators to adjacency matrices

    examples:
        -- learn some knowledge:
        -- load matrices.sw
        M1 |x1> => 3|y2>
        M1 |x2> => 7|y1> + 6|y2>
        M1 |x3> => |y1> + 4|y2>
        M1 |x4> => |y1>
        M1 |x5> => 6|y1> + 4|y2>
        M1 |x6> => 4|y1> + 8|y2>
        M1 |x7> => |y1> + 2|y2>
        
        M2 |y1> => 6|z1> + 2|z2> + 7|z3> + 9|z4> + 5|z5>
        M2 |y2> => 3|z2> + 4|z3> + |z5>

    
        -- display corresponding matrices:
        matrix[M1]
            [ y1 ] = [  0  7  1  1  6  4  1  ] [ x1 ]
            [ y2 ]   [  3  6  4  0  4  8  2  ] [ x2 ]
                                               [ x3 ]
                                               [ x4 ]
                                               [ x5 ]
                                               [ x6 ]
                                               [ x7 ]
        
        matrix[M2]
            [ z1 ] = [  6  0  ] [ y1 ]
            [ z2 ]   [  2  3  ] [ y2 ]
            [ z3 ]   [  7  4  ]
            [ z4 ]   [  9  0  ]
            [ z5 ]   [  5  1  ]
        
        matrix[M2, M1]
            [ z1 ] = [  6  0  ] [  0  7  1  1  6  4  1  ] [ x1 ]
            [ z2 ]   [  2  3  ] [  3  6  4  0  4  8  2  ] [ x2 ]
            [ z3 ]   [  7  4  ]                           [ x3 ]
            [ z4 ]   [  9  0  ]                           [ x4 ]
            [ z5 ]   [  5  1  ]                           [ x5 ]
                                                          [ x6 ]
                                                          [ x7 ]
        
        matrix[M1, M2]
            [  ] = [            ] [  6  0  ] [ y1 ]
                                  [  2  3  ] [ y2 ]
                                  [  7  4  ]
                                  [  9  0  ]
                                  [  5  1  ]

        -- only display matrix for desired inputs:
        matrix[M1] split |x1 x3 x5 x7>
            [ y1 ] = [  0  1  6  1  ] [ x1 ]
            [ y2 ]   [  3  4  4  2  ] [ x3 ]
                                      [ x5 ]
                                      [ x7 ]

    see also:
        merged-matrix, naked-matrix

Home