20 #ifndef TESSERACT_CCSTRUCT_LINLSQ_H_ 21 #define TESSERACT_CCSTRUCT_LINLSQ_H_ 36 void add(
double x,
double y);
38 void add(
double x,
double y,
double weight);
42 void remove(
double x,
double y);
48 double c(
double m)
const;
49 double rms(
double m,
double c)
const;
113 template<
typename T> T MedianOfCircularValues(T modulus,
GenericVector<T>* v) {
115 T halfrange =
static_cast<T
>(modulus / 2);
116 int num_elements = v->
size();
117 for (
int i = 0; i < num_elements; ++i) {
118 stats.
add((*v)[i], (*v)[i] + halfrange);
122 for (
int i = 0; i < num_elements; ++i) {
123 (*v)[i] += halfrange;
128 for (
int i = 0; i < num_elements; ++i) {
129 (*v)[i] -= halfrange;
132 return (*v)[median_index];
136 #endif // TESSERACT_CCSTRUCT_LINLSQ_H_ double sigxy
Definition: linlsq.h:99
FCOORD vector_fit() const
Definition: linlsq.cpp:251
double c(double m) const
Definition: linlsq.cpp:116
void add(double x, double y)
Definition: linlsq.cpp:48
LLSQ()
Definition: linlsq.h:30
double rms(double m, double c) const
Definition: linlsq.cpp:130
int choose_nth_item(int target_index)
Definition: genericvector.h:309
FCOORD mean_point() const
Definition: linlsq.cpp:166
double sigx
Definition: linlsq.h:96
double sigy
Definition: linlsq.h:97
int32_t count() const
Definition: linlsq.h:43
double m() const
Definition: linlsq.cpp:100
int size() const
Definition: genericvector.h:71
double y_variance() const
Definition: linlsq.h:87
double sigyy
Definition: linlsq.h:100
double pearson() const
Definition: linlsq.cpp:153
double total_weight
Definition: linlsq.h:95
double sigxx
Definition: linlsq.h:98
double x_variance() const
Definition: linlsq.h:81
double rms_orth(const FCOORD &dir) const
Definition: linlsq.cpp:195
double covariance() const
Definition: linlsq.h:75
void clear()
Definition: linlsq.cpp:32