annotate lls.h @ 79:adbb5540fa47 libavutil

calculate all coefficients for several orders during cholesky factorization, the resulting coefficients are not strictly optimal though as there is a small difference in the autocorrelation matrixes which is ignored for the smaller orders
author michael
date Sat, 15 Jul 2006 23:43:38 +0000
parents 8c75234388b5
children b916c714f77b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
76
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
1 /*
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
2 * linear least squares model
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
3 *
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
4 * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
5 *
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
6 * This library is free software; you can redistribute it and/or
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
9 * version 2 of the License, or (at your option) any later version.
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
10 *
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
11 * This library is distributed in the hope that it will be useful,
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
14 * Lesser General Public License for more details.
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
15 *
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
17 * License along with this library; if not, write to the Free Software
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
19 */
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
20
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
21 #ifndef LLS_H
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
22 #define LLS_H
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
23
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
24 #define MAX_VARS 32
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
25
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
26 //FIXME avoid direct access to LLSModel from outside
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
27
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
28 /**
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
29 * Linear least squares model.
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
30 */
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
31 typedef struct LLSModel{
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
32 double covariance[MAX_VARS+1][MAX_VARS+1];
79
adbb5540fa47 calculate all coefficients for several orders during cholesky factorization, the resulting coefficients are not strictly optimal though as there is a small difference in the autocorrelation matrixes which is ignored for the smaller orders
michael
parents: 76
diff changeset
33 double coeff[MAX_VARS][MAX_VARS];
adbb5540fa47 calculate all coefficients for several orders during cholesky factorization, the resulting coefficients are not strictly optimal though as there is a small difference in the autocorrelation matrixes which is ignored for the smaller orders
michael
parents: 76
diff changeset
34 double variance[MAX_VARS];
76
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
35 int indep_count;
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
36 }LLSModel;
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
37
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
38 void av_init_lls(LLSModel *m, int indep_count);
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
39 void av_update_lls(LLSModel *m, double *param, double decay);
79
adbb5540fa47 calculate all coefficients for several orders during cholesky factorization, the resulting coefficients are not strictly optimal though as there is a small difference in the autocorrelation matrixes which is ignored for the smaller orders
michael
parents: 76
diff changeset
40 void av_solve_lls(LLSModel *m, double threshold, int min_order);
adbb5540fa47 calculate all coefficients for several orders during cholesky factorization, the resulting coefficients are not strictly optimal though as there is a small difference in the autocorrelation matrixes which is ignored for the smaller orders
michael
parents: 76
diff changeset
41 double av_evaluate_lls(LLSModel *m, double *param, int order);
76
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
42
8c75234388b5 linear least squares solver using cholesky factorization
michael
parents:
diff changeset
43 #endif