#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include "include/hholder.h"#include "include/qr.h"Functions | |
| int | qr (double **A, int m, int n, double *B, double *X, double *rnorm, double *tau, double *res, double **wws, double *ws) |
| int | qr_decomp (double **a, int M, int N, double *tau, double **cchain, double *chain) |
| int | qr_solve (double **QR, int M, int N, double *tau, double *b, double *x, double *residual, double *resNorm, double **cchain, double *chain) |
| int | qr_QTvec (double **QR, double *tau, double *v, double *help) |
| int | qr_Qvec (double **QR, double *tau, double *v, double *help) |
| int | qr_invRvec (double **A, double *X) |
| int | qr_weight (int N, int M, double **A, double *b, double *weight) |
Variables | |
| int | qr_M |
| int | qr_N |
| int | qr_MNmin |
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
Factorise a general M x N matrix A into A = Q R where Q is orthogonal (M x M) and R is upper triangular (M x N). Q is stored as a packed set of Householder vectors in the strict lower triangular part of the input matrix A and a set of coefficients in vector tau. R is stored in the diagonal and upper triangle of the input matrix. The full matrix for Q can be obtained as the product Q = Q_1 Q_2 .. Q_k and it's transform as the product Q^T = Q_k .. Q_2 Q_1 where k = min(M,N) and Q_i = (I - tau_i * h_i * h_i^T) and where h_i is a Householder vector h_i = [1, A(i+1,i), A(i+2,i), ... , A(M,i)] This storage scheme is the same as in LAPACK. NOTICE! The calling program must take care that pointer tau is of size n.
|
|
||||||||||||
|
Form the product R^-1 v. (R is saved in the upper triangel of QR matrix.)
|
|
||||||||||||||||||||
|
Form the product Q^T v from householder vectors saved in the lower triangel of QR matrix and householder coefficients saved in vector tau.
|
|
||||||||||||||||||||
|
Form the product Q v from householder vectors saved in the lower triangel of QR matrix and householder coefficients saved in vector tau.
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
Find the least squares solution to the overdetermined system A x = b for m >= n using the QR factorisation A = Q R. qr_decomp() must be used prior to this function in order to form the QR factorisation of A. Solution is formed in the following order: QR x = b => R x = Q^T b => x = R^-1 (Q^T b) NOTICE! The calling program must take care that pointers b, x and residual are of the right size.
|
|
||||||||||||||||||||||||
|
Algorithm for weighting the problem that is given to qr-algorithm. Square roots of weights are used because in qr the difference w*A-w*b is squared.
|
|
|
Global variables for this routine |
|
|
|
|
|
|
1.4.1