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

◆ dgecovs()

void dgecovs ( int  job,
int  n,
int  lda,
double  a[],
double  s[],
double  ci[],
double  work[],
int *  info 
)

Unscaled covariance matrix of linear least squares problem solved by dgelss

Purpose
dgecovs computes the unscaled covariance matrix of linear least squares problem solved by dgelss.

The following least squares problem with m x n matrix A can be solved by dgelss.
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 lower 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 right singular vectors returned by dgelss.
[out] job = -1: a[][] is overwritten by the lower triangule of C. The strictly upper triangle part of a[][] is destroyed.
[in]s[]Array s[ls] (ls >= n)
Singular values computed by dgelss.
[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]work[]Array work[lwork] (lwork >= n)
Work array.
[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))