compound seq fn: spike-merge


spike-merge:
    description:
        spike-merge[t] input-seq
        merge t time steps of superpositions in the given input sequence
        the motivation for this operator is the idea of spike trains in neural circuits
        this operator takes a t time step sum of spikes,
        resulting in a more compressed spike train,
        that corresponds to a longer measurement window

    examples:
        -- just an abstract example:
        spike-merge[2] ssplit |abcdefghi>
            |a> + |b> . |c> + |d> . |e> + |f> . |g> + |h> . |i>

        -- and another:
        spike-merge[3] ssplit |abcdefghi>
            |a> + |b> + |c> . |d> + |e> + |f> . |g> + |h> + |i>

        -- an example closer to that of a neural spike train:
        -- note that for this to work we make use of |> as the identity element for superpositions
        -- ie: sp + |> == |> + sp == sp, for any superposition sp
        the |spike train> => 3|a> . |> . |> . |> . 5|b> . |> . |c> . |> . |> . |> . |> . |> . 2|d> . |> . |>

        spike-merge[2] the |spike train>
            3|a> . |> . 5|b> . |c> . |> . |> . 2|d> . |>

        spike-merge[3] the |spike train>
            3|a> . 5|b> . |c> . |> . 2|d>

        spike-merge[4] the |spike train>
            3|a> . 5|b> + |c> . |> . 2|d>

        spike-merge[5] the |spike train>
            3|a> + 5|b> . |c> . 2|d>

        spike-merge[6] the |spike train>
            3|a> + 5|b> . |c> . 2|d>

        spike-merge[7] the |spike train>
            3|a> + 5|b> + |c> . 2|d> . |>

        spike-merge[8] the |spike train>
            3|a> + 5|b> + |c> . 2|d>


        -- we can also merge spike trains using the op-sum[] operator
        the-spike-train |1> => 3|a> . |> . |> . |> . 5|b> . |> . |c> . |> . |> . |> . |> . |> . 2|d> . |> . |>
        the-spike-train |2> => |> . |> . 9|x> . |> . |> . |y> . |> . |> . |> . |> . 13|z> . |> . |>
        the-spike-train |3> => |> . |u> . |> . |v> . |> . |w> . |> . |> . |> . |>

        -- now merge them:
        op-sum[the-spike-train] split[" "] |1 2 3>
            3|a> . |u> . 9|x> . |v> . 5|b> . |y> + |w> . |c> . |> . |> . |> . 13|z> . |> . 2|d> . |> . |>

    see also:
        op-sum

Home