XLPack 7.0
XLPack Numerical Library (Excel Worksheet Functions) Reference Manual
Loading...
Searching...
No Matches

◆ WZggglm()

Function WZggglm ( N As  Long,
M As  Long,
P As  Long,
A As  Variant,
B As  Variant,
D As  Variant 
)

General Gauss-Markov linear model (GLM) problem of complex matrices (complex number representation in Excel format)

Purpose
WZggglm solves a general Gauss-Markov linear model (GLM) problem:
minimize || y ||_2 subject to d = A*x + B*y
x
where A is an N x M matrix, B is an N x P matrix, and d is a given N-vector. It is assumed that M <= N <= M + P, and
rank(A) = M and rank(A B) = N
Under these assumptions, the constrained equation is always consistent, and there is a unique solution x and a minimal 2-norm solution y, which is obtained using a generalized QR factorization of the matrices (A, B) given by
A = Q*(R), B = Q*T*Z
(0)
In particular, if matrix B is square nonsingular, then the problem GLM is equivalent to the following weighted linear least squares problem
minimize || inv(B)*(d - A*x) ||_2
x

To represent complex numbers in Excel cells, complex number format in Excel (e.g. 2.5+1i) is used. Worksheet function Complex can be used to input complex numbers into cells.
Returns
max(M,P)+1 x 2
Column 1Column 2
Rows 1 to max(M,P)Least squares solution vector x (Rows 1 to M)Residual vector y (Rows 1 to P)
Row max(M,P)+12-norm of residual sum of squares (||y||2)Return code

Return code
= 0: Successful exit
= 1: The least squares solution could not be computed. The upper triangular factor R associated with A in the generalized QR factorization of the pair (A, B) is singular, so that rank(A) < M.
= 2: The least squares solution could not be computed. The bottom N-M x N-M part of the upper trapezoidal factor T associated with B in the generalized QR factorization of the pair (A, B) is singular, so that rank(A B) < N.
Parameters
[in]NNumber of rows of the matrices A and B. (N >= 1)
[in]MNumber of columns of the matrix A. (1 <= M <= N)
[in]PNumber of columns of the matrix B. (N - M <= P)
[in]A(N x M) N x M coefficient matrix A of the GLM equation.
[in]B(N x P) N x P coefficient matrix B of the GLM equation.
[in]D(N) Left hand side vector d of the GLM equation.
Reference
LAPACK
Example
Solve a general Gauss-Markov linear model (GLM) problem, i.e. find x which minimizes || y ||_2 subject to d = A*x + B*y, where
( -0.82+0.83i 0.18-0.94i -0.18-0.12i )
A = ( -0.76-0.24i 0.57-0.16i -0.08-0.27i )
( 1.90+0.26i -0.98+0.54i 0.21+0.28i )
( 0.50-0.30i -0.31+0.37i 0.22+0.19i )
( 1 0 0 0 )
B = ( 0 1 0 0 )
( 0 0 1 0 )
( 0 0 0 1 )
( 1.7126-0.6648i )
d = ( 0.8697+0.7604i )
( -2.1048-1.6171i )
( -0.9297+0.1252i )

WZggglm