An O(n2) algorithm for the bidiagonal SVD