XLPack 6.1
C/C++ API Reference Manual (Basic module)
Loading...
Searching...
No Matches

◆ _dgecov()

void _dgecov ( int  job,
int  n,
int  lda,
double  a[],
double  ci[],
int *  info 
)

Unscaled covariance matrix of linear least squares problem solved by dgels

Purpose
dgecov computes the unscaled covariance matrix of linear least squares problem solved by dgels.

The following least squares problem with m x n matrix A can be solved by dgels if rank(A) = n.
minimize ||A*x - b||
The n x n symmetric positive definite matrix C, the unscaled covariance matrix of the estimated parameters, is defined as below.
C = (A^T*A)^(-1), rank(A) = n
The scalar multiple (sigma^2)*C has a statiscal interpretation of being an estimate of the variance-covariance matrix for the solution vector of the least squares problem. The scalar factor sigma^2 is expressed as follows.
sigma^2 = ||A*x - b||^2 / (m - n)
where x is the least squares solution. The diagonal elements of (sigma^2)*C give the variance of each component of x.
Parameters
[in]job= -1: The upper triangle of C is computed.
= 0: The diagonal elements of C are computed.
= i > 0: i-th column of C is computed. (i <= n)
[in]nThe order of the matrix A = rank of A. (should not be rank deficient). (n >= 0) (If n = 0, returns without computation)
[in]ldaLeading dimension of the two dimensional array a[][]. (lda >= max(1, n))
[in,out]a[][]Array a[la][lda] (la >= n)
[in] The QR factorized matrix returned by dgels.
[out] job = -1: a[][] is overwritten by the upper triangle of C.
  job = 0: The upper triangle of a[][] is to be destroyed.
[out]ci[]Array ci[lci] (lci >= n)
job = -1: Not referenced.
job = 0: The diagonal elements of C are returned.
job = i > 0: The i-th column of C is returned.
[out]info= 0: Successful exit
= -1: The argument job had an illegal value (job < -1 or job > n)
= -2: The argument n had an illegal value (n < 0)
= -3: The argument lda had an illegal value (lda < max(1, n))
= i > 0: Other error encountered