Robotran C Documentation
Classes | Macros | Functions
svdcmp_lapack.c File Reference
#include "lapacke.h"
#include "useful_functions.h"
#include "mbs_message.h"
#include "mbs_errors_names.h"

Classes

struct  complex_float
 Implementation of eig function using lapacke without using the lapackE interface. More...
 
struct  complex_double
 

Macros

#define lapack_complex_float   struct complex_float
 
#define lapack_complex_double   struct complex_double
 

Functions

int mbs_over_under_determined (double **A, double *b, int x, int y)
 Solve a linear system of equations, A*x=b, using dgelss lapack function. More...
 
int mbs_svdDcmp_0 (double **A, int x, int y, double **U, double **S, double **VT)
 Realize the singular value decomposition. More...
 

Macro Definition Documentation

◆ lapack_complex_double

#define lapack_complex_double   struct complex_double

◆ lapack_complex_float

#define lapack_complex_float   struct complex_float

Function Documentation

◆ mbs_over_under_determined()

int mbs_over_under_determined ( double **  A,
double *  b,
int  x,
int  y 
)

Solve a linear system of equations, A*x=b, using dgelss lapack function.

This function mainly transfers the MBsysC arrays with index starting at 1 (see get_dmat_1() and get_dvec_1()) to Lapack-compatible arrays (index starting at 0, col. major memory).

The following explanations come from the Lapack documentation. This function solves overdetermined or underdetermined systems.

For overdetermined system it minimizes 2-norm(| b - A*x |).

For underdetermined system it minimizes 2-norm(| x |).

Parameters
[in,out]Amain matrix of size [x,y] with first line and row unused using row major memory.
[in,out]bAs input it contains the vector b of size [y] with index starting at 1. As output it contains the solution vector x.

For overdetermined system, the residual sum-of-squares for the solution is the sum of the elements from b[x+1] to b[y+1].

Parameters
[in]xthe number of row of A, which is the number of equations.
[in]ythe number of col. of A, which is the number of unknowns.
Returns
error status, < 0 in case of failure.

◆ mbs_svdDcmp_0()

int mbs_svdDcmp_0 ( double **  A,
int  x,
int  y,
double **  U,
double **  S,
double **  VT 
)

Realize the singular value decomposition.

A = U * S * transpose(V)

Parameters
[in]A: the rectangular matrix
[in]x: the number of row of A
[in]y: the number of row of A
[in]U: the x-by-x orthogonal matrix U;
[in]S: the x-by-y matrix which is zero except for its min(x,y) diagonal elements
[in]VT: the y-by-y orthogonal matrix V**T.