XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ covar()

void covar ( int  n,
int  ldr,
double  r[],
int  ipvt[],
double  tol,
double  work[],
int *  info 
)

Covariance matrix of nonlinear least squares approximation

Purpose
covar computes the covariance matrix of nonlinear least squares approximation computed by lmder, lmder1, lmdif, lmstr or lmstr1.

Given an m x n matrix A, the n x n symmetric matrix corresponding to A, called as the covariance matrix C, is defined as follows.
C = (A^T*A)^(-1)
This routine completes this equation using the necessary information from the QR factorization of A which is provided by lmder, lmder1, lmdif, lmstr or lmstr1.
Parameters
[in]nOrder of covariance matrix. (n > 0)
[out]ldrLeading dimension of two dimensional array r[]. (ldr >= n)
[in,out]r[][]Array r[lr][ldr] (lr >= n)
[in] The upper triangle matrix R obtained from QR factorization AP = QR. (P is the permutation matrix given by ipvt[], and Q is m x n orthogonal matrix)
[out] The square symmetrix covariance matrix.
[out]ipvt[]Array ipvt[lipvt] (lipvt >= n)
The pivot indices that define the permutation matrix P.
[in]tolThe tolerance to determine the numerical rank of the matrix A. (tol > 0)
If some diagonal element of R is less than (the maximum absolute value of diagonal elements of R)*tol in magnitude, it will be regarded as rank deficient.
[out]work[]Array work[lwork] (lwork >= n)
Work area.
[out]info= 0: Successful exit
= -1: The argument n had an illegal value (n <= 0)
= -2: The argument ldr had an illegal value (ldr < n)
= -5: The argument tol had an illegal value (tol <= 0)
Reference
netlib/minpack