'Call the user\'s `compute` function on each window with a pre-built
output array.'

def _compute(self, windows, dates, assets, mask):

    format_inputs = self._format_inputs
    compute = self.compute
    params = self.params
    ndim = self.ndim
    shape = ((len(mask), 1) if (ndim == 1) else mask.shape)
    out = self._allocate_output(windows, shape)
    with self.ctx:
        for (idx, date) in enumerate(dates):
            out_mask = (array([True]) if (ndim == 1) else mask[idx])
            inputs_mask = mask[idx]
            masked_assets = assets[inputs_mask]
            out_row = out[idx][out_mask]
            inputs = format_inputs(windows, inputs_mask)
            compute(date, masked_assets, out_row, *inputs, **params)
            out[idx][out_mask] = out_row
    return out
