  We give an algorithm with singly exponential complexity for computing the
barcodes up to dimension $\ell$ (for any fixed $\ell \geq 0$) of the filtration
of a given semi-algebraic set by the sub-level sets of a given polynomial. Our
algorithm is the first algorithm for this problem with singly exponential
complexity, and generalizes the corresponding results for computing the Betti
numbers up to dimension $\ell$ of semi-algebraic sets with no filtration
present.
