operator: srank

    description:
        srank seq
        apply position in sequence to coefficient
        ie, rank them

    examples:
        srank ssplit |abcdefg>
            |a> . 2|b> . 3|c> . 4|d> . 5|e> . 6|f> . 7|g>

        -- works similarly for sequences of superpositions:
        srank (|a> + |b> . |c> . |d> + |e> + |f> . |g> . |h> + |i> + |j> + |k>)
            |a> + |b> . 2|c> . 3|d> + 3|e> + 3|f> . 4|g> . 5|h> + 5|i> + 5|j> + 5|k>

        long-display srank (|a> + |b> . |c> . |d> + |e> + |f> . |g> . |h> + |i> + |j> + |k>)
            seq |0> => |a> + |b>
            seq |1> => 2|c>
            seq |2> => 3|d> + 3|e> + 3|f>
            seq |3> => 4|g>
            seq |4> => 5|h> + 5|i> + 5|j> + 5|k>
            |a> + |b> . 2|c> . 3|d> + 3|e> + 3|f> . 4|g> . 5|h> + 5|i> + 5|j> + 5|k>


        -- an approximate implementation using op-zip:
        -- define our multiply operators:
        m1 |*> #=> |_self>
        m2 |*> #=> 2|_self>
        m3 |*> #=> 3|_self>
        m4 |*> #=> 4|_self>
        m5 |*> #=> 5|_self>

        -- define our operator sequence:
        op |seq> => |op: m1> . |op: m2> . |op: m3> . |op: m4> . |op: m5>

        -- define our version of srank:
        my-srank (*) #=> op-zip(op |seq>, |_self>)

        -- try it out:
        -- NB: |f> is ignored, since 'op |seq>' is only length 5
        my-srank (|a> . |b> . |c> . |d> . |e> . |f>)
            |a> . 2|b> . 3|c> . 4|d> . 5|e>

        long-display my-srank (|a> + |b> . |c> . |d> + |e> + |f> . |g> . |h> + |i> + |j> + |k>)
            seq |0> => |a> + |b>
            seq |1> => 2|c>
            seq |2> => 3|d> + 3|e> + 3|f>
            seq |3> => 4|g>
            seq |4> => 5|h> + 5|i> + 5|j> + 5|k>
            |a> + |b> . 2|c> . 3|d> + 3|e> + 3|f> . 4|g> . 5|h> + 5|i> + 5|j> + 5|k>

    see also:
        rank, op-zip

Home