This function computes the number of peaks in a double vector, with
peak defined as per Goldfeld65;textualskedastic. The function
is used in the Goldfeld-Quandt nonparametric test for heteroskedasticity in
a linear model. NA and NaN values in the sequence are ignored.