Regularized linearization for quantum nonlinear optical cavities: application to degenerate optical parametric oscillators.