Rebin a vector

Syntax: | `REBIN x y n`

Suppose that the length of vector `x` is N then:

that is, the length of `y` will be N`/n`, and

If is not equal to N, then the last element of `y` will be incomplete. For example, if N `= 10` and n = 3 then `y` will have `3` elements:

       y[1] = x[1] + x[2] + x[3]
       y[2] = x[4] + x[5] + x[6]
       y[3] = x[7] + x[8] + x[9]

and `x[10]` will not be included in `y`.

Examples

Suppose that vector `X` has `20` elements and vector `DATA` has `1000` elements.

command | result
`REBIN X XOUT 2` |
`XOUT[ 1]` | `=` | `X[ 1] + X[ 2]`
`XOUT[ 2]` | `=` | `X[ 3] + X[ 4]`
`XOUT[ 3]` | `=` | `X[ 5] + X[ 6]`
| `...` |
`XOUT[10]` | `=` | `X[19] + X[20]`
`REBIN DATA DOUT 3` |
`DOUT[ 1]` | `=` | `DATA[ 1] + DATA[ 2] + DATA[ 3]`
`DOUT[ 2]` | `=` | `DATA[ 4] + DATA[ 5] + DATA[ 6]`
`DOUT[ 3]` | `=` | `DATA[ 7] + DATA[ 8] + DATA[ 9]`
| `...` |
`DOUT[333]` | `=` | `DATA[997] + DATA[998] + DATA[999]`

A warning will be given that the length of `DATA` is not evenly divisible by `3` and so the last bin is incomplete.

REBIN command
Rebin a matrix