hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_lapack_dggglm (f08zb)

Purpose

nag_lapack_dggglm (f08zb) solves a real general Gauss–Markov linear (least squares) model problem.

Syntax

[a, b, d, x, y, info] = f08zb(a, b, d, 'm', m, 'n', n, 'p', p)
[a, b, d, x, y, info] = nag_lapack_dggglm(a, b, d, 'm', m, 'n', n, 'p', p)

Description

nag_lapack_dggglm (f08zb) solves the real general Gauss–Markov linear model (GLM) problem
minimize y2  subject to  d = Ax + By
x
minimize x y2  subject to  d=Ax+By
where AA is an mm by nn matrix, BB is an mm by pp matrix and dd is an mm element vector. It is assumed that nmn + pnmn+p, rank(A) = nrank(A)=n and rank(E) = mrank(E)=m, where E =
(AB)
E= A B . Under these assumptions, the problem has a unique solution xx and a minimal 22-norm solution yy, which is obtained using a generalized QRQR factorization of the matrices AA and BB.
In particular, if the matrix BB is square and nonsingular, then the GLM problem is equivalent to the weighted linear least squares problem
minimize B1(dAx)2.
x
minimize x B-1 (d-Ax) 2 .

References

Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia
Anderson E, Bai Z and Dongarra J (1992) Generalized QR factorization and its applications Linear Algebra Appl. (Volume 162–164) 243–271

Parameters

Compulsory Input Parameters

1:     a(lda, : :) – double array
The first dimension of the array a must be at least max (1,m)max(1,m)
The second dimension of the array must be at least max (1,n)max(1,n)
The mm by nn matrix AA.
2:     b(ldb, : :) – double array
The first dimension of the array b must be at least max (1,m)max(1,m)
The second dimension of the array must be at least max (1,p)max(1,p)
The mm by pp matrix BB.
3:     d(m) – double array
m, the dimension of the array, must satisfy the constraint m0m0.
The left-hand side vector dd of the GLM equation.

Optional Input Parameters

1:     m – int64int32nag_int scalar
Default: The dimension of the array d and the first dimension of the array b. (An error is raised if these dimensions are not equal.)
mm, the number of rows of the matrices AA and BB.
Constraint: m0m0.
2:     n – int64int32nag_int scalar
Default: The second dimension of the array a.
nn, the number of columns of the matrix AA.
Constraint: 0nm0nm.
3:     p – int64int32nag_int scalar
Default: The second dimension of the array b.
pp, the number of columns of the matrix BB.
Constraint: pmnpm-n.

Input Parameters Omitted from the MATLAB Interface

lda ldb work lwork

Output Parameters

1:     a(lda, : :) – double array
The first dimension of the array a will be max (1,m)max(1,m)
The second dimension of the array will be max (1,n)max(1,n)
2:     b(ldb, : :) – double array
The first dimension of the array b will be max (1,m)max(1,m)
The second dimension of the array will be max (1,p)max(1,p)
3:     d(m) – double array
4:     x(n) – double array
The solution vector xx of the GLM problem.
5:     y(p) – double array
The solution vector yy of the GLM problem.
6:     info – int64int32nag_int scalar
info = 0info=0 unless the function detects an error (see Section [Error Indicators and Warnings]).

Error Indicators and Warnings

  info = iinfo=-i
If info = iinfo=-i, parameter ii had an illegal value on entry. The parameters are numbered as follows:
1: m, 2: n, 3: p, 4: a, 5: lda, 6: b, 7: ldb, 8: d, 9: x, 10: y, 11: work, 12: lwork, 13: info.
It is possible that info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.
  INFO = 1INFO=1
The upper triangular factor RR associated with AA in the generalized RQRQ factorization of the pair (A,B)(A,B) is singular, so that rank(A) < mrank(A)<m; the least squares solution could not be computed.
  INFO = 2INFO=2
The bottom (NM)(N-M) by (NM)(N-M) part of the upper trapezoidal factor TT associated with BB in the generalized QRQR factorization of the pair (A,B)(A,B) is singular, so that rank
(AB)
< N
rankAB<N; the least squares solutions could not be computed.

Accuracy

For an error analysis, see Anderson et al. (1992). See also Section 4.6 of Anderson et al. (1999).

Further Comments

When p = mnp=mn, the total number of floating point operations is approximately (2/3)(2m3n3) + 4nm223(2m3-n3)+4nm2; when p = m = np=m=n, the total number of floating point operations is approximately (14/3)m3143m3.

Example

function nag_lapack_dggglm_example
a = [-0.57, -1.28, -0.39;
     -1.93, 1.08, -0.31;
     2.3, 0.24, -0.4;
     -0.02, 1.03, -1.43];
b = [0.5, 0, 0, 0;
     0, 1, 0, 0;
     0, 0, 2, 0;
     0, 0, 0, 5];
d = [1.32;
     -4;
     5.52;
     3.24];
[aOut, bOut, dOut, x, y, info] = nag_lapack_dggglm(a, b, d)
 

aOut =

    3.0562   -0.2694   -0.0232
    0.5322   -1.9623    0.7189
   -0.6343   -0.1120    1.3913
    0.0055    0.2893    0.5605


bOut =

   -1.2131    0.2669   -0.8691    0.6131
   -0.5707    0.7105    1.8876    1.8248
    0.1229    0.2076    2.4417    2.9277
   -0.0373   -0.1437   -0.2765   -2.3759


dOut =

    1.9889
   -1.0058
   -2.9911
   -0.0094


x =

    1.9889
   -1.0058
   -2.9911


y =

   -0.0006
   -0.0025
   -0.0047
    0.0077


info =

                    0


function f08zb_example
a = [-0.57, -1.28, -0.39;
     -1.93, 1.08, -0.31;
     2.3, 0.24, -0.4;
     -0.02, 1.03, -1.43];
b = [0.5, 0, 0, 0;
     0, 1, 0, 0;
     0, 0, 2, 0;
     0, 0, 0, 5];
d = [1.32;
     -4;
     5.52;
     3.24];
[aOut, bOut, dOut, x, y, info] = f08zb(a, b, d)
 

aOut =

    3.0562   -0.2694   -0.0232
    0.5322   -1.9623    0.7189
   -0.6343   -0.1120    1.3913
    0.0055    0.2893    0.5605


bOut =

   -1.2131    0.2669   -0.8691    0.6131
   -0.5707    0.7105    1.8876    1.8248
    0.1229    0.2076    2.4417    2.9277
   -0.0373   -0.1437   -0.2765   -2.3759


dOut =

    1.9889
   -1.0058
   -2.9911
   -0.0094


x =

    1.9889
   -1.0058
   -2.9911


y =

   -0.0006
   -0.0025
   -0.0047
    0.0077


info =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013