NAG Library Routine Document F08ZFF (DGGRQF).1

Similar documents
NAG Library Routine Document F08FNF (ZHEEV).1

NAG Library Routine Document F08FAF (DSYEV)

NAG Library Routine Document F08YUF (ZTGSEN).1

NAG Library Routine Document F08FPF (ZHEEVX)

NAG Library Routine Document F08JDF (DSTEVR)

F08BEF (SGEQPF/DGEQPF) NAG Fortran Library Routine Document

NAG Library Routine Document F07HAF (DPBSV)

NAG Fortran Library Routine Document F04CFF.1

NAG Library Routine Document F08PNF (ZGEES)

NAG Library Routine Document F08VAF (DGGSVD)

NAG Library Routine Document F02HDF.1

NAG Library Routine Document F08UBF (DSBGVX)

NAG Library Routine Document F08QUF (ZTRSEN)

NAG Library Routine Document F08QVF (ZTRSYL)

NAG Toolbox for Matlab nag_lapack_dggev (f08wa)

F04JGF NAG Fortran Library Routine Document

G03ACF NAG Fortran Library Routine Document

G01NBF NAG Fortran Library Routine Document

G13DSF NAG Fortran Library Routine Document

NAG Fortran Library Routine Document D02JAF.1

LAPACK-Style Codes for Pivoted Cholesky and QR Updating

LAPACK-Style Codes for Pivoted Cholesky and QR Updating. Hammarling, Sven and Higham, Nicholas J. and Lucas, Craig. MIMS EPrint: 2006.

NAG Library Routine Document D02JAF.1

G13CCF NAG Fortran Library Routine Document

G13DCF NAG Fortran Library Routine Document

G13BHF NAG Fortran Library Routine Document

Module 6.6: nag nsym gen eig Nonsymmetric Generalized Eigenvalue Problems. Contents

Algorithm 853: an Efficient Algorithm for Solving Rank-Deficient Least Squares Problems

G13BAF NAG Fortran Library Routine Document

NAG Library Routine Document C02AGF.1

Exponentials of Symmetric Matrices through Tridiagonal Reductions

Computing least squares condition numbers on hybrid multicore/gpu systems

G13CGF NAG Fortran Library Routine Document

Generalized interval arithmetic on compact matrix Lie groups

G13DJF NAG Fortran Library Routine Document

Aasen s Symmetric Indefinite Linear Solvers in LAPACK

D03PEF NAG Fortran Library Routine Document

NAG Toolbox for MATLAB Chapter Introduction. F02 Eigenvalues and Eigenvectors

A note on eigenvalue computation for a tridiagonal matrix with real eigenvalues Akiko Fukuda

7.6 The Inverse of a Square Matrix

LAPACK-Style Codes for Level 2 and 3 Pivoted Cholesky Factorizations. C. Lucas. Numerical Analysis Report No February 2004

Matrix operations Linear Algebra with Computer Science Application

Intel Math Kernel Library (Intel MKL) LAPACK

NAG Library Chapter Introduction. f08 Least-squares and Eigenvalue Problems (LAPACK)

D02TYF NAG Fortran Library Routine Document

Implementation for LAPACK of a Block Algorithm for Matrix 1-Norm Estimation

NAG C Library Function Document nag_dtrevc (f08qkc)

Review Let A, B, and C be matrices of the same size, and let r and s be scalars. Then

Using Godunov s Two-Sided Sturm Sequences to Accurately Compute Singular Vectors of Bidiagonal Matrices.

Module 5.2: nag sym lin sys Symmetric Systems of Linear Equations. Contents

Positive Denite Matrix. Ya Yan Lu 1. Department of Mathematics. City University of Hong Kong. Kowloon, Hong Kong. Abstract

Theoretical Computer Science

MATH2210 Notebook 2 Spring 2018

Lecture 6. Numerical methods. Approximation of functions

On aggressive early deflation in parallel variants of the QR algorithm

Lesson U2.1 Study Guide

Matrix Algebra 2.1 MATRIX OPERATIONS Pearson Education, Inc.

Week6. Gaussian Elimination. 6.1 Opening Remarks Solving Linear Systems. View at edx

Applied Numerical Linear Algebra. Lecture 8

Linear Algebra V = T = ( 4 3 ).

Unsupervised Data Discretization of Mixed Data Types

Matrix Eigensystem Tutorial For Parallel Computation

Elementary Row Operations on Matrices

More Gaussian Elimination and Matrix Inversion

A.l INTRODUCTORY CONCEPTS AND OPERATIONS umnx, = b, az3z3 = b, i = 1,... m (A.l-2)

ICS 6N Computational Linear Algebra Matrix Algebra

Matrix Algebra: Definitions and Basic Operations

A New Block Algorithm for Full-Rank Solution of the Sylvester-observer Equation.

Chapter 7. Tridiagonal linear systems. Solving tridiagonal systems of equations. and subdiagonal. E.g. a 21 a 22 a A =

Review Questions REVIEW QUESTIONS 71

D. Gimenez, M. T. Camara, P. Montilla. Aptdo Murcia. Spain. ABSTRACT

ACCURACY AND STABILITY OF THE NULL SPACE METHOD FOR SOLVING THE EQUALITY CONSTRAINED LEAST SQUARES PROBLEM

MAC Module 2 Systems of Linear Equations and Matrices II. Learning Objectives. Upon completing this module, you should be able to :

Porting a Sphere Optimization Program from lapack to scalapack

Pivoting. Reading: GV96 Section 3.4, Stew98 Chapter 3: 1.3

MTH5112 Linear Algebra I MTH5212 Applied Linear Algebra (2017/2018)

NAG Library Routine Document D02KDF.1

The LINPACK Benchmark in Co-Array Fortran J. K. Reid Atlas Centre, Rutherford Appleton Laboratory, Chilton, Didcot, Oxon OX11 0QX, UK J. M. Rasmussen

Chapter 4 - MATRIX ALGEBRA. ... a 2j... a 2n. a i1 a i2... a ij... a in

Computation of a canonical form for linear differential-algebraic equations

Linear Algebra (Review) Volker Tresp 2017

Determinant: 3.3 Properties of Determinants

LAPACK Introduction. Zhaojun Bai University of California/Davis. James Demmel University of California/Berkeley

NAG Fortran Library Routine Document D02KDF.1

Chapter 2 Notes, Linear Algebra 5e Lay

Algebraic Equations. 2.0 Introduction. Nonsingular versus Singular Sets of Equations. A set of linear algebraic equations looks like this:

MATH2071: LAB #7: Factorizations

Linear Algebra and Matrix Inversion

MATRICES. a m,1 a m,n A =

NAG Toolbox for Matlab. g03aa.1

Basic Concepts in Linear Algebra

Mathematics. EC / EE / IN / ME / CE. for

Section 9.2: Matrices. Definition: A matrix A consists of a rectangular array of numbers, or elements, arranged in m rows and n columns.

Multiplying matrices by diagonal matrices is faster than usual matrix multiplication.

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations

MATRICES. knowledge on matrices Knowledge on matrix operations. Matrix as a tool of solving linear equations with two or three unknowns.

Matrix & Linear Algebra

Review of Basic Concepts in Linear Algebra

Maximum Likelihood Estimation and Polynomial System Solving

1. Introduction. Applying the QR algorithm to a real square matrix A yields a decomposition of the form

Transcription:

NAG Library Routine Document Note: before using this routine, please read the Users Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details. 1 Purpose computes a generalized RQ factorization of a real matrix pair ða; BÞ, where A is an m by n matrix and B is a p by n matrix. 2 Specification SUBROUTINE F08ZFF(M, P, N, A, LDA, TAUA, B, LDB, TAUB, WORK, LWORK, 1 INFO) INTEGER M, P, N, LDA, LDB, LWORK, INFO double precision A(LDA,), TAUA(min(M,N)), B(LDB,), TAUB(min(P,N)), 1 WORK(max(1,LWORK)) The routine may be called by its LAPACK name dggrqf. 3 Description forms the generalized RQ factorization of an m by n matrix A and a p by n matrix B A ¼ RQ, B ¼ ZTQ, where Q is an n by n orthogonal matrix, Z is a p by p orthogonal matrix and R and T are of the form 8 n m m m 0 R 12 ; if m n; >< R ¼ n! m n R 11 >: ; if m>n; n R 21 with R 12 or R 21 upper triangular, 8 >< T ¼ >: n n T 11 p n 0! ; if p n; p n p p T 11 T 12 ; if p<n; with T 11 upper triangular. In particular, if B is square and nonsingular, the generalized RQ factorization of A and B implicitly gives the RQ factorization of AB 1 as AB 1 ¼ RT 1 Z T..1

NAG Library Manual 4 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, Philadelphiahttp://www.netlib.org/lapack/lug Anderson E, Bai Z and Dongarra J (1992) Generalized QR factorization and its applications Linear Algebra Appl. (Volume 162 164) 243 271 Hammarling S (1987) The numerical solution of the general Gauss-Markov linear model Mathematics in Signal Processing (eds T S Durrani, J B Abbiss, J E Hudson, R N Madan, J G McWhirter and T A Moore) 441 456 Oxford University Press Paige C C (1990) Some aspects of generalized QR factorizations. In Reliable Numerical Computation (eds M G Cox and S Hammarling) 73 91 Oxford University Press 5 Parameters 1: M INTEGER Input On entry: m, the number of rows of the matrix A. Constraint: M 0. 2: P INTEGER Input On entry: p, the number of rows of the matrix B. Constraint: P 0. 3: N INTEGER Input On entry: n, the number of columns of the matrices A and B. Constraint: N 0. 4: AðLDA,Þ double precision array Input/Output Note: the second dimension of the array A must be at least maxð1; NÞ. On entry: the m by n matrix A. On exit: ifm n, the upper triangle of the subarray Að1 : m; n m þ 1 : nþ contains the m by m upper triangular matrix R 12. If m n, the elements on and above the ðm nþth subdiagonal contain the m by n upper trapezoidal matrix R; the remaining elements, with the array TAUA, represent the orthogonal matrix Q as a product of minðm; nþ elementary reflectors (see Section 3.3.6 in the F08 Chapter Introduction). 5: LDA INTEGER Input On entry: the first dimension of the array A as declared in the (sub)program from which F08ZFF (DGGRQF) is called. Constraint: LDA maxð1; MÞ. 6: TAUAðminðM; NÞÞ double precision array Output On exit: the scalar factors of the elementary reflectors which represent the orthogonal matrix Q. 7: BðLDB,Þ double precision array Input/Output Note: the second dimension of the array B must be at least maxð1; NÞ. On entry: the p by n matrix B..2

On exit: the elements on and above the diagonal of the array contain the minðp; nþ by n upper trapezoidal matrix T (T is upper triangular if p n); the elements below the diagonal, with the array TAUB, represent the orthogonal matrix Z as a product of elementary reflectors (see Section 3.3.6 in the F08 Chapter Introduction). 8: LDB INTEGER Input On entry: the first dimension of the array B as declared in the (sub)program from which F08ZFF (DGGRQF) is called. Constraint: LDB maxð1; PÞ. 9: TAUBðminðP; NÞÞ double precision array Output On exit: the scalar factors of the elementary reflectors which represent the orthogonal matrix Z. 10: WORKðmaxð1; LWORKÞÞ double precision array Workspace On exit: if INFO ¼ 0, WORKð1Þ contains the minimum value of LWORK required for optimal performance. 11: LWORK INTEGER Input On entry: the dimension of the array WORK as declared in the (sub)program from which F08ZFF (DGGRQF) is called. If LWORK ¼ 1, a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued. Suggested value: for optimal performance, LWORK maxðn; M; PÞmaxðnb1; nb2; nb3þ, where nb1 is the optimal block size for the RQ factorization of an m by n matrix by F08CHF (DGERQF), nb2 is the optimal block size for the QR factorization of a p by n matrix by F08AEF (DGEQRF), and nb3 is the optimal block size for a call of F08CKF (DORMRQ). Constraint: LWORK maxð1; N; M; PÞ or LWORK ¼ 1. 12: INFO INTEGER Output On exit: INFO ¼ 0 unless the routine detects an error (see Section 6). 6 Error Indicators and Warnings Errors or warnings detected by the routine: INFO < 0 If INFO ¼ i, argument i had an illegal value. An explanatory message is output, and execution of the program is terminated. 7 Accuracy The computed generalized RQ factorization is the exact factorization for nearby matrices ðb þ F Þ, where and is the machine precision. 8 Further Comments kek 2 ¼ O A k k 2 and kf k 2 ¼ O B k k 2, ða þ EÞ and The orthogonal matrices Q and Z may be formed explicitly by calls to F08CJF (DORGRQ) and F08AFF (DORGQR) respectively. F08CKF (DORMRQ) may be used to multiply Q by another matrix and F08AGF (DORMQR) may be used to multiply Z by another matrix..3

NAG Library Manual The complex analogue of this routine is F08ZTF (ZGGRQF). 9 Example This example solves the linear equality constrained least squares problem min kc Axk x 2 subject to Bx ¼ d where 0 1 0:57 1:28 0:39 0:25 1:93 1:08 0:31 2:14 2:30 0:24 0:40 0:35 A ¼ 1:93 0:64 0:66 0:08 ; B ¼ 1 0 1 0, B C 0 1 0 1 @ 0:15 0:30 0:15 2:13 A 0:02 1:03 1:43 0:50 0 1 1:50 2:14 1:23 c ¼ B 0:54 C @ 1:68 A 0:82 and d ¼ 0 0 The constraints Bx ¼ d correspond to x 1 ¼ x 3 and x 2 ¼ x 4. The solution is obtained by first computing a generalized RQ factorization of the matrix pair ðb; AÞ. The example illustrates the general solution process. Note that the block size (NB) of 64 assumed in this example is not realistic for such a small problem, but should be suitable for large problems. 9.1 Program Text F08ZFF Example Program Text Mark 21 Release. NAG Copyright 2004... Parameters.. INTEGER NIN, NOUT (NIN=5,NOUT=6) INTEGER PMAX, NB, NMAX, MMAX (PMAX=10,NB=64,NMAX=10,MMAX=10) INTEGER LDB, LDA, LWORK (LDB=PMAX,LDA=MMAX,LWORK=NB(PMAX+NMAX)) DOUBLE PRECISION ONE (ONE=1.0D0).. Local Scalars.. DOUBLE PRECISION RNORM INTEGER I, INFO, J, M, N, P.. Local Arrays.. DOUBLE PRECISION A(LDA,NMAX), B(LDB,NMAX), C(PMAX), D(MMAX), + TAUA(MIN(MMAX,NMAX)), TAUB(MIN(PMAX,NMAX)), + WORK(LWORK), X(NMAX).. External Functions.. DOUBLE PRECISION DNRM2 EXTERNAL DNRM2.. External Subroutines.. EXTERNAL DCOPY, DGEMV, DGGRQF, DORMQR, DORMRQ, DTRMV, + DTRTRS.. Intrinsic Functions.. INTRINSIC MIN.. Executable Statements.. WRITE (NOUT,) F08ZFF Example Program Results WRITE (NOUT,) Skip heading in data file READ (NIN,)..4

READ (NIN,) P, N, M IF (P.LE.PMAX.AND. N.LE.NMAX.AND. M.LE.MMAX.AND. M.LE.N.AND. + N.LE.(P+M)) THEN Read B, A, C and D from data file READ (NIN,) ((B(I,J),J=1,N),I=1,P) READ (NIN,) ((A(I,J),J=1,N),I=1,M) READ (NIN,) (C(I),I=1,P) READ (NIN,) (D(I),I=1,M) Compute the generalized RQ factorization of (B,A) as A = (0 R12)Q, B = Z(T11 T12 T13)Q, where R12, T11 and T22 ( 0 T22 T23) are upper triangular CALL DGGRQF(M,P,N,A,LDA,TAUA,B,LDB,TAUB,WORK,LWORK,INFO) Compute (f1) = (ZT)c, storing the result in C (f2) CALL DORMQR( Left, Transpose,P,1,MIN(P,N),B,LDB,TAUB,C,P, + WORK,LWORK,INFO) Putting Qx = (y1), solve R12w = d for w, storing result in D (w ) CALL DTRTRS( Upper, No transpose, Non-unit,M,1,A(1,N-M+1), + LDA,D,M,INFO) IF (INFO.GT.0) THEN WRITE (NOUT,) + The upper triangular factor, R12, of A is singular, WRITE (NOUT,) + the least squares solution could not be computed GO TO 40 Form f1 - T1w, T1 = (T12 T13), in C CALL DGEMV( No transpose,n-m,m,-one,b(1,n-m+1),ldb,d,1,one,c, + 1) Solve T11y1 = f1 - T1w for y1, storing result in C CALL DTRTRS( Upper, No transpose, Non-unit,N-M,1,B,LDB,C, + N-M,INFO) IF (INFO.GT.0) THEN WRITE (NOUT,) + The upper triangular factor, T11, of B is singular, WRITE (NOUT,) + the least squares solution could not be computed GO TO 40 Copy y into X (first y1, then w) CALL DCOPY(N-M,C,1,X,1) CALL DCOPY(M,D,1,X(N-M+1),1) Compute x = (QT)y CALL DORMRQ( Left, Transpose,N,1,M,A,LDA,TAUA,X,N,WORK,LWORK, + INFO) Putting w = (y2), form f2 - T22y2 - T23y3 (y3) T22y2.5

NAG Library Manual CALL DTRMV( Upper, No transpose, Non-unit,MIN(P,N)-N+M, + B(N-M+1,N-M+1),LDB,D,1) f2 - T22y2 DO 20 I = 1, MIN(P,N) - N + M C(N-M+I) = C(N-M+I) - D(I) 20 CONTINUE IF (P.LT.N) THEN f2 - T22y2 - T23y3 CALL DGEMV( No transpose,p-n+m,n-p,-one,b(n-m+1,p+1),ldb, + D(P-N+M+1),1,ONE,C(N-M+1),1) Compute estimate of the square root of the residual sum of squares norm(r) = norm(f2 - T22y2 - T23y3) RNORM = DNRM2(P-(N-M),C(N-M+1),1) Print least squares solution x WRITE (NOUT,) Constrained least squares solution WRITE (NOUT,99999) (X(I),I=1,N) Print estimate of the square root of the residual sum of squares WRITE (NOUT,) WRITE (NOUT,) Square root of the residual sum of squares WRITE (NOUT,99998) RNORM ELSE WRITE (NOUT,) + One or more of PMAX, NMAX or MMAX is too small,, + and/or N.LT.M or N.GT.(P+M) 40 CONTINUE 99999 FORMAT (1X,7F11.4) 99998 FORMAT (3X,1P,E11.2) END 9.2 Program Data F08ZFF Example Program Data 6 4 2 :Values of P, N and M -0.57-1.28-0.39 0.25-1.93 1.08-0.31-2.14 2.30 0.24 0.40-0.35-1.93 0.64-0.66 0.08 0.15 0.30 0.15-2.13-0.02 1.03-1.43 0.50 :End of matrix B 1.00 0.00-1.00 0.00 0.00 1.00 0.00-1.00 :End of matrix A -1.50-2.14 1.23-0.54-1.68 0.82 :End of vector C 0.00 0.00 :End of vector D.6

9.3 Program Results F08ZFF Example Program Results Constrained least squares solution 0.4890 0.9975 0.4890 0.9975 Square root of the residual sum of squares 2.51E-02.7 (last)