Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
pprz_matrix_decomp_float.h File Reference

Matrix decompositions in floating point. More...

#include "std.h"
+ Include dependency graph for pprz_matrix_decomp_float.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void pprz_cholesky_float (float **out, float **in, int n)
 Cholesky decomposition. More...
 
void pprz_qr_float (float **Q, float **R, float **in, int m, int n)
 QR decomposition. More...
 
int pprz_svd_float (float **a, float *w, float **v, int m, int n)
 SVD decomposition. More...
 
void pprz_svd_solve_float (float **x, float **u, float *w, float **v, float **b, int m, int n, int l)
 SVD based linear solver. More...
 
void fit_linear_model (float *targets, int D, float(*samples)[D], uint16_t count, bool use_bias, float *params, float *fit_error)
 Fit a linear model from samples to target values. More...
 
void fit_linear_model_prior (float *targets, int D, float(*samples)[D], uint16_t count, bool use_bias, float *priors, float *params, float *fit_error)
 Fit a linear model from samples to target values with a prior. More...
 

Detailed Description

Matrix decompositions in floating point.

Definition in file pprz_matrix_decomp_float.h.

Function Documentation

void fit_linear_model ( float *  targets,
int  D,
float(*)  samples[D],
uint16_t  count,
bool  use_bias,
float *  params,
float *  fit_error 
)

Fit a linear model from samples to target values.

Effectively a wrapper for the pprz_svd_float and pprz_svd_solve_float functions.

Parameters
[in]targetsThe target values
[in]samplesThe samples / feature vectors
[in]DThe dimensionality of the samples
[in]countThe number of samples
[out]parameters*Parameters of the linear fit
[out]fit_error*Total error of the fit

Effectively a wrapper for the pprz_svd_float and pprz_svd_solve_float functions.

Parameters
[in]targetsThe target values
[in]samplesThe samples / feature vectors
[in]DThe dimensionality of the samples
[in]countThe number of samples
[in]use_biasWhether to use the bias. Please note that params should always be of size D+1, but in case of no bias, the bias value is set to 0.
[out]parameters*Parameters of the linear fit
[out]fit_error*Total error of the fit

Definition at line 526 of file pprz_matrix_decomp_float.c.

References AA, D, MAKE_MATRIX_PTR, MAT_MUL, MAT_SUB, n_samples, pprz_svd_float(), and pprz_svd_solve_float().

Referenced by RANSAC_linear_model().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fit_linear_model_prior ( float *  targets,
int  D,
float(*)  samples[D],
uint16_t  count,
bool  use_bias,
float *  priors,
float *  params,
float *  fit_error 
)

Fit a linear model from samples to target values with a prior.

Effectively a wrapper for the pprz_svd_float and pprz_svd_solve_float functions.

Parameters
[in]targetsThe target values
[in]samplesThe samples / feature vectors
[in]DThe dimensionality of the samples
[in]countThe number of samples
[in]use_biasWhether to use the bias. Please note that params should always be of size D+1, but in case of no bias, the bias value is set to 0.
[in]priorsPrior per dimension. If use_bias, also for the dimension D+1.
[out]parameters*Parameters of the linear fit
[out]fit_error*Total error of the fit

Definition at line 614 of file pprz_matrix_decomp_float.c.

References AA, D, DEBUG_MAT_PRINT, DEBUG_PRINT, float_mat_invert(), float_mat_mul(), float_mat_sum(), float_mat_transpose(), MAKE_MATRIX_PTR, MAT_MUL, MAT_SUB, and n_samples.

Referenced by RANSAC_linear_model().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void pprz_cholesky_float ( float **  out,
float **  in,
int  n 
)

Cholesky decomposition.

http://rosettacode.org/wiki/Cholesky_decomposition#C

Parameters
outpointer to the output array [n x n]
inpointer to the input array [n x n]
ndimension of the matrix

Definition at line 50 of file pprz_matrix_decomp_float.c.

References float_mat_copy(), float_mat_zero(), MAKE_MATRIX_PTR, and s.

+ Here is the call graph for this function:

void pprz_qr_float ( float **  Q,
float **  R,
float **  in,
int  m,
int  n 
)

QR decomposition.

using Householder method

http://rosettacode.org/wiki/QR_decomposition#C

Parameters
Qsquare orthogonal matrix Q [m x m]
Rupper triangular matrix R [m x n]
inpointer to the input array [m x n]
mnumber of rows of the input matrix
nnumber of columns of the input matrix

using Householder method

http://rosettacode.org/wiki/QR_decomposition#C

Parameters
Qsquare orthogonal matrix Q [m x m]
Rupper triangular matrix R [m x n]
inpointer to the input array [m x n]
mnumber of rows of the input matrix
nnumber of column of the input matrix

Definition at line 89 of file pprz_matrix_decomp_float.c.

References float_mat_col(), float_mat_copy(), float_mat_minor(), float_mat_mul(), float_mat_transpose_square(), float_mat_vmul(), float_vect_norm(), float_vect_sdiv(), Int32RMat::m, MAKE_MATRIX_PTR, z1, and z2.

+ Here is the call graph for this function:

int pprz_svd_float ( float **  a,
float *  w,
float **  v,
int  m,
int  n 
)

SVD decomposition.

------------------------------------------------------------------— * Reference: "Numerical Recipes By W.H. Press, B. P. Flannery, * S.A. Teukolsky and W.T. Vetterling, Cambridge * University Press, 1986" [BIBLI 08]. *

Given a matrix a(m,n), this routine computes its singular value decomposition, A = U · W · Vt. The matrix U replaces a on output. The diagonal matrix of singular values W is output as a vector w(n). The matrix V (not the transpose Vt) is output as v(n,n).

Parameters
ainput matrix [m x n] and output matrix U [m x n]
woutput diagonal vector of matrix W [n]
voutput square matrix V [n x n]
mnumber of rows of input the matrix
nnumber of columns of the input matrix
Returns
0 (false) if convergence failed, 1 (true) if decomposition succed

------------------------------------------------------------------— * Reference: "Numerical Recipes By W.H. Press, B. P. Flannery, * S.A. Teukolsky and W.T. Vetterling, Cambridge * University Press, 1986" [BIBLI 08]. * ------------------------------------------------------------------— *

Given a matrix a(m,n), this routine computes its singular value decomposition, A = U · W · Vt. The matrix U replaces a on output. The diagonal matrix of singular values W is output as a vector w(n). The matrix V (not the transpose Vt) is output as v(n,n).

Parameters
ainput matrix [m x n] and output matrix U [m x n]
woutput diagonal vector of matrix W [n]
voutput square matrix V [n x n]
mnumber of rows of input the matrix
nnumber of columns of the input matrix
Returns
0 (false) if convergence failed, 1 (true) if decomposition succed

Definition at line 164 of file pprz_matrix_decomp_float.c.

References H, Int32RMat::m, pythag(), mesonh.mesonh_atmosphere::X, mesonh.mesonh_atmosphere::Y, and mesonh.mesonh_atmosphere::Z.

Referenced by fit_linear_flow_field(), fit_linear_model(), and pprz_polyfit_float().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void pprz_svd_solve_float ( float **  x,
float **  u,
float *  w,
float **  v,
float **  b,
int  m,
int  n,
int  l 
)

SVD based linear solver.

Solves A · X = B for a vector X, where A is specified by the arrays u, w, v as returned by pprz_svd_float. m and n are the dimensions of a. b(m) is the input right-hand side. x(n) is the output solution vector. No input quantities are destroyed, so the routine may be called sequentially with different b's.

Parameters
xsolution of the system ([n x l] matrix)
uU matrix from SVD decomposition
wdiagonal of the W matrix from the SVD decomposition
vV matrrix from SVD decomposition
bright-hand side input matrix from system to solve (column vector [m x l])
mnumber of rows of the matrix A
nnumber of columns of the matrix A
lnumber of columns of the matrix B

Definition at line 491 of file pprz_matrix_decomp_float.c.

References Int32RMat::m, and s.

Referenced by fit_linear_flow_field(), fit_linear_model(), and pprz_polyfit_float().

+ Here is the caller graph for this function: