49 for (i = 0; i < v.
n(); ++i)
60 for (i = 0; i < v.
n(); ++i)
94 v[j] += pow(m(i, j) - u(j), float(2.0));
107 for (j = 0; j < v.
n(); ++j)
126 c(j, k) += (m(i, j) - u(j)) * (m(i, k) - u(k));
145 r(j, k) = c(j, k)/(s(j) * s(k));
166 z(i, j) = (m(i, j) -
sub(j)) / div(j);
181 cout <<
"pop mean " << gu;
183 for (i = 0; i < n; ++i)
184 for (j = 0; j < n; ++j)
187 for (k = 0; k < p; ++k)
188 P(i, j) += pow(gu(i, k) - gu(j, k),
float(2.0)) / gv(k);
215 for (i = 0; i < n; ++i)
216 for (j = 0; j < n; ++j)
232 for (k = 0; k < n; ++k)
233 P += pow(ui(k) - uj(k),
float(2.0)) / v(k);
245 for (i = 0; i < num_pop; ++i)
259 for (i = 0; i < num_pop; ++i)
260 l += in[i].num_rows();
265 for (k = l = 0; k < num_pop; ++k)
266 for (j =0; j < n; ++j, ++l)
267 for (i = 0; i < in[i].
num_rows(); ++i)
268 msum(l, j) = in[k](i, j);
EST_FMatrix mahalanobis_distance(EST_FMatrix &gu, EST_FMatrix &covar)
EST_FMatrix euclidean_distance(EST_FMatrix &m)
float single_mahal(EST_FMatrix &ui, EST_FMatrix &uj, EST_FMatrix &invv)
EST_FMatrix row(const EST_FMatrix &a, ssize_t row)
float mean(EST_FVector &v)
ssize_t num_columns() const
return number of columns
A vector class for floating point numbers. EST_FVector x should be used instead of float *x wherever ...
EST_FMatrix penrose_distance(EST_FMatrix &gu, EST_FVector &gv)
EST_FVector sample_variance(EST_FMatrix &m)
ssize_t num_rows() const
return number of rows
float sum(EST_FVector &v)
EST_FMatrix sample_correlation(EST_FMatrix &m)
EST_FMatrix sub(const EST_FMatrix &a, ssize_t row, ssize_t col)
float simple_penrose(EST_FVector &ui, EST_FVector &uj, EST_FVector &v)
void multiply(const EST_DMatrix &a, const EST_DMatrix &b, EST_DMatrix &ab)
EST_FVector sample_stdev(EST_FMatrix &m)
EST_FMatrix population_mean(EST_FMatrix *in, int num_pop)
void transpose(const EST_FMatrix &a, EST_FMatrix &b)
exchange rows and columns
EST_FMatrix add_populations(EST_FMatrix *in, int num_pop)
EST_FMatrix normalise(EST_FMatrix &m, EST_FVector &sub, EST_FVector &div)
EST_FMatrix sample_covariance(EST_FMatrix &m)
INLINE ssize_t n() const
number of items in vector.
int inverse(const EST_FMatrix &a, EST_FMatrix &inv)
inverse