#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... | |
#define lapack_complex_double struct complex_double |
#define lapack_complex_float struct complex_float |
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 |).
[in,out] | A | main matrix of size [x,y] with first line and row unused using row major memory. |
[in,out] | b | As 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].
[in] | x | the number of row of A, which is the number of equations. |
[in] | y | the number of col. of A, which is the number of unknowns. |
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)
[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. |