'Compute by delegating to self._wrapped_term._compute on sample dates.
On non-sample dates, forward-fill from previously-computed samples.'

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

    to_sample = dates[select_sampling_indices(dates, self._frequency)]
    assert (to_sample[0] == dates[0]), ('Misaligned    sampling    dates    in    %s.' % type(self).__name__)
    real_compute = self._wrapped_term._compute
    if self.windowed:
        def prepare_inputs():
            return inputs
        def skip_this_input():
            for w in inputs:
                next(w)
    else:
        def prepare_inputs():
            return [a[[i]] for a in inputs]
        def skip_this_input():
            pass
    results = []
    samples = iter(to_sample)
    next_sample = next(samples)
    for (i, compute_date) in enumerate(dates):
        if (next_sample == compute_date):
            results.append(real_compute(prepare_inputs(), dates[i:(i + 1)], assets, mask[i:(i + 1)]))
            try:
                next_sample = next(samples)
            except StopIteration:
                next_sample = pd_NaT
        else:
            skip_this_input()
            results.append(results[(-1)])
    try:
        next_sample = next(samples)
    except StopIteration:
        pass
    else:
        raise AssertionError(('Unconsumed    sample    date:    %s' % next_sample))
    return vstack(results)
