summaryrefslogtreecommitdiff
path: root/controller/fw/levmarq/levmarq.h
blob: dff13abefb52472adf8196d3e2dc9c0c46e6fc78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef __LEVMARQ_H__
#define __LEVMARQ_H__

typedef struct {
  int max_it;
  float init_lambda;
  float up_factor;
  float down_factor;
  float target_derr;
  int final_it;
  float final_err;
  float final_derr;
} LMstat;

void levmarq_init(LMstat *lmstat);

int levmarq(int npar, float *par, int ny, float *y, float *dysq,
	    float (*func)(float *, int, void *),
	    void (*grad)(float *, float *, int, void *),
	    void *fdata, LMstat *lmstat);

float error_func(float *par, int ny, float *y, float *dysq,
		  float (*func)(float *, int, void *), void *fdata);

void solve_axb_cholesky(int n, float l[n][n], float x[n], float b[n]);

int cholesky_decomp(int n, float l[n][n], float a[n][n]);

#endif /* __LEVMARQ_H__ */