diff --git a/regression.hh b/regression.hh index 5d9dece..ccd298d 100644 --- a/regression.hh +++ b/regression.hh @@ -14,7 +14,7 @@ class SimpleLinearRegression TYPE xint_, yint_, slope_; public: SimpleLinearRegression() : xint_(0), yint_(0), slope_(0) {} - SimpleLinearRegression(TYPE *x, TYPE *y, int LEN) + SimpleLinearRegression(const TYPE *x, const TYPE *y, int LEN) { TYPE avgX(0), avgY(0); for (int i = 0; i < LEN; ++i) { @@ -32,7 +32,7 @@ public: slope_ = covXY / varX; yint_ = avgY - slope_ * avgX; } - SimpleLinearRegression(TYPE *y, int l, TYPE x0 = 0, TYPE dx = 1) + SimpleLinearRegression(const TYPE *y, int l, TYPE x0 = 0, TYPE dx = 1) { TYPE midL((l-1) / TYPE(2)); TYPE avgX(x0 + dx*midL); diff --git a/repeated_median.hh b/repeated_median.hh index 2ba25b7..eded617 100644 --- a/repeated_median.hh +++ b/repeated_median.hh @@ -17,7 +17,7 @@ class RepeatedMedianEstimator TYPE xint_, yint_, slope_; public: RepeatedMedianEstimator() : xint_(0), yint_(0), slope_(0) {} - void compute(TYPE *x, TYPE *y, int LEN) + void compute(const TYPE *x, const TYPE *y, int LEN) { if (LEN > SIZE) LEN = SIZE; @@ -68,7 +68,7 @@ class RepeatedMedianEstimator2 TYPE xint_, yint_, slope_; public: RepeatedMedianEstimator2() : xint_(0), yint_(0), slope_(0) {} - void compute(TYPE *x, TYPE *y, int LEN) + void compute(const TYPE *x, const TYPE *y, int LEN) { if (LEN > SIZE) LEN = SIZE; diff --git a/spline.hh b/spline.hh index 8849e80..25114e8 100644 --- a/spline.hh +++ b/spline.hh @@ -15,7 +15,7 @@ class UniformNaturalCubicSpline ITYPE x0, dx; public: UniformNaturalCubicSpline() = default; - UniformNaturalCubicSpline(OTYPE *Y, ITYPE x0 = 0, ITYPE dx = 1, int STRIDE = 1) : x0(x0), dx(dx) + UniformNaturalCubicSpline(const OTYPE *Y, ITYPE x0 = 0, ITYPE dx = 1, int STRIDE = 1) : x0(x0), dx(dx) { ITYPE U[KNOTS-1]; U[0] = ITYPE(0); diff --git a/theil_sen.hh b/theil_sen.hh index c565153..86a343c 100644 --- a/theil_sen.hh +++ b/theil_sen.hh @@ -18,7 +18,7 @@ class TheilSenEstimator TYPE xint_, yint_, slope_; public: TheilSenEstimator() : xint_(0), yint_(0), slope_(0) {} - void compute(TYPE *x, TYPE *y, int LEN) + void compute(const TYPE *x, const TYPE *y, int LEN) { int count = 0; for (int i = 0; count < size_ && i < LEN; ++i)