57 for (j = i; j <
count; j++) {
58 double sum = covar[i][j];
60 for (k = 0; k <= i-1; k++)
73 for (i = 0; i <
count; i++) {
74 double sum = covar_y[i + 1];
76 for (k = 0; k <= i-1; k++)
82 for (j = count - 1; j >= min_order; j--) {
83 for (i = j; i >= 0; i--) {
84 double sum = m->
coeff[0][i];
86 for (k = i + 1; k <= j; k++)
94 for (i = 0; i <= j; i++) {
95 double sum = m->
coeff[j][i] * covar[i][i] - 2 * covar_y[i + 1];
97 for (k = 0; k < i; k++)
98 sum += 2 * m->
coeff[j][k] * covar[k][i];
110 for (i = 0; i <= order; i++)
111 out += param[i] * m->
coeff[order][i];
141 for (i = 0; i < 100; i++) {
145 var[0] = (
av_lfg_get(&lfg) / (double) UINT_MAX - 0.5) * 2;
146 var[1] = var[0] +
av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
147 var[2] = var[1] +
av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
148 var[3] = var[2] +
av_lfg_get(&lfg) / (double) UINT_MAX - 0.5;
151 for (order = 0; order < 3; order++) {
153 printf(
"real:%9f order:%d pred:%9f var:%f coeffs:%f %9f %9f\n",
154 var[0], order, eval, sqrt(m.
variance[order] / (i + 1)),
double covariance[(((32+1)+(4)-1)&~((4)-1))][(((32+1)+(4)-1)&~((4)-1))]
Linear least squares model.
static double evaluate_lls(LLSModel *m, const double *param, int order)
double variance[MAX_VARS]
Macro definitions for various function/variable attributes.
Libavutil version macros.
av_cold void avpriv_init_lls(LLSModel *m, int indep_count)
common internal API header
void avpriv_solve_lls(LLSModel *m, double threshold, unsigned short min_order)
double(* evaluate_lls)(struct LLSModel *m, const double *var, int order)
Inner product of var[] and the LPC coefs.
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
static const int factor[16]
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
#define LOCAL_ALIGNED(a, t, v,...)
void(* update_lls)(struct LLSModel *m, const double *var)
Take the outer-product of var[] with itself, and add to the covariance matrix.
static void update_lls(LLSModel *m, const double *var)
int main(int argc, char **argv)
void ff_init_lls_x86(LLSModel *m)