*
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
*
- * This library is free software; you can redistribute it and/or
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
- * @file lls.c
+ * @file libavutil/lls.c
* linear least squares model
*/
#include "lls.h"
-#ifdef TEST
-#define av_log(a,b,...) printf(__VA_ARGS__)
-#endif
-
void av_init_lls(LLSModel *m, int indep_count){
memset(m, 0, sizeof(LLSModel));
void av_solve_lls(LLSModel *m, double threshold, int min_order){
int i,j,k;
- double (*factor)[MAX_VARS+1]= &m->covariance[1][0];
- double (*covar )[MAX_VARS+1]= &m->covariance[1][1];
+ double (*factor)[MAX_VARS+1]= (void*)&m->covariance[1][0];
+ double (*covar )[MAX_VARS+1]= (void*)&m->covariance[1][1];
double *covar_y = m->covariance[0];
int count= m->indep_count;
#include <stdlib.h>
#include <stdio.h>
-int main(){
+int main(void){
LLSModel m;
int i, order;
for(i=0; i<100; i++){
double var[4];
- double eval, variance;
+ double eval;
#if 0
var[1] = rand() / (double)RAND_MAX;
var[2] = rand() / (double)RAND_MAX;
av_solve_lls(&m, 0.001, 0);
for(order=0; order<3; order++){
eval= av_evaluate_lls(&m, var+1, order);
- av_log(NULL, AV_LOG_DEBUG, "real:%f order:%d pred:%f var:%f coeffs:%f %f %f\n",
+ printf("real:%f order:%d pred:%f var:%f coeffs:%f %f %f\n",
var[0], order, eval, sqrt(m.variance[order] / (i+1)),
m.coeff[order][0], m.coeff[order][1], m.coeff[order][2]);
}