RcdMathLib_doc
Open Source Library for Linear and Non-linear Algebra
qr_givens.h File Reference

Givens algorithm for the QR-decomposition. Provide necessary methods to construct Q- and R- matrices using Givens rotations. A = QR, where Q is an (m $\times$ n)-matrix with orthonormal columns and R is an (n $\times$ n) upper triangular matrix. More...

#include <inttypes.h>
#include "matrix.h"

Go to the source code of this file.

Functions

int8_t qr_givens_decomp (uint8_t m, uint8_t n, matrix_t A[][n], uint8_t q_col_num, matrix_t Q[][q_col_num], bool reduced)
 Computes the QR decomposition of the matrix A by using the Givens algorithm. More...
 
void qr_givens_get_params (matrix_t xjj, matrix_t xij, matrix_t c_s_t_r_vec[])
 Compute the Givens parameters. More...
 

Detailed Description

Givens algorithm for the QR-decomposition. Provide necessary methods to construct Q- and R- matrices using Givens rotations. A = QR, where Q is an (m $\times$ n)-matrix with orthonormal columns and R is an (n $\times$ n) upper triangular matrix.

Author
Zakaria Kasmi zkasm.nosp@m.i@in.nosp@m.f.fu-.nosp@m.berl.nosp@m.in.de

Definition in file qr_givens.h.

Function Documentation

◆ qr_givens_decomp()

int8_t qr_givens_decomp ( uint8_t  m,
uint8_t  n,
matrix_t  A[][n],
uint8_t  q_col_num,
matrix_t  Q[][q_col_num],
bool  reduced 
)

Computes the QR decomposition of the matrix A by using the Givens algorithm.

Gets a QR decomposition of an m-by-n matrix A such that A = Q*R. The compact as well as the full decomposition of the matrix can be computed.

Note
R is stored in the matrix A.
Parameters
[in]mrow number of the matrix.
[in]ncolumn number of the matrix.
[in,out]A[][]pointer to the matrices A and R.
[in]q_col_numcolumn number of the matrix Q.
[out]Q[][]pointer to the Q matrix.
[in]reducedcomputes the compact form of the QR decomposition if true, otherwise the full version.
Returns
1, if computing the QR decomposition is successful.
-1, if computing the QR decomposition is not successful.

Definition at line 33 of file qr_givens.c.

References matrix_clear(), matrix_get_upp_triang(), matrix_part_copy(), matrix_t, and qr_givens_get_params().

Referenced by givens_test(), and solve_givens().

◆ qr_givens_get_params()

void qr_givens_get_params ( matrix_t  xjj,
matrix_t  xij,
matrix_t  c_s_t_r_vec[] 
)

Compute the Givens parameters.

The computation of the parameters c, s, t, and r can have problems with overflow or underflow, therefore this algorithm employs a normalization procedure. The Givens parameters c, s, t and r are saved in a vector.

Parameters
[in]xjjvalue at the diagonal j of the matrix.
[in]xijvalue at the index j of a column vector i.
[out]c_s_t_r_vec[]pointer to the vector holding the c, s, t and r parameters.

Definition at line 110 of file qr_givens.c.

References matrix_t.

Referenced by givens_test(), and qr_givens_decomp().