MC64 1 SUMMARY 2 HOW TO USE THE PACKAGE PACKAGE SPECIFICATION HSL 2013

Similar documents
PACKAGE SPECIFICATION HSL 2013

HSL MC64 1 SUMMARY 2 HOW TO USE THE PACKAGE. All use is subject to licence. 1 C INTERFACE HSL 2013

PACKAGE SPECIFICATION HSL 2013

PACKAGE SPECIFICATION HSL 2013

PACKAGE SPECIFICATION HSL 2013

PACKAGE SPECIFICATION HSL To solve a symmetric, sparse and positive definite set of linear equations Ax = b i.e. j=1

CALL MC36A(NMAX,NZMAX,TITLE,ELT,NROW,NCOL,NNZERO, * COLPTR,ROWIND,VALUES,MAXRHS,NRHS,NZRHS,RHSPTR, * RHSIND,RHSVAL,GUESS,SOLN,IW,ICNTL,INFO)

MA41 SUBROUTINE LIBRARY SPECIFICATION 1st Aug. 2000

MA27 1 SUMMARY 2 HOW TO USE THE PACKAGE

ME22. All use is subject to licence. ME22 v Documentation date: 19th March SUMMARY 2 HOW TO USE THE PACKAGE

All use is subject to licence, see For any commercial application, a separate licence must be signed.

HARWELL SUBROUTINE LIBRARY SPECIFICATION Release 13 (1998)

HSL MA48 1 SUMMARY 2 HOW TO USE THE PACKAGE. All use is subject to licence. 1 C INTERFACE HSL 2013

All use is subject to licence, see For any commercial application, a separate licence must be signed.

ME38. All use is subject to licence. ME38 v Documentation date: 15th April SUMMARY 2 HOW TO USE THE PACKAGE

F01BSF NAG Fortran Library Routine Document

Sparse Linear Systems

Algorithm 837: AMD, An Approximate Minimum Degree Ordering Algorithm

E04JAF NAG Fortran Library Routine Document

HSL MA97 1 SUMMARY 2 HOW TO USE THE PACKAGE. All use is subject to licence. 1 C INTERFACE

E04JYF NAG Fortran Library Routine Document

PARDISO Version Reference Sheet Fortran

NAG Fortran Library Routine Document D01AJF.1

All use is subject to licence. See For any commercial application, a separate license must be signed.

All use is subject to licence. See For any commercial application, a separate license must be signed.

PACKAGE SPECIFICATION 21 I S 22 P = I

3. Replace any row by the sum of that row and a constant multiple of any other row.

NAG Library Routine Document H03ADF.1

PACKAGE SPECIFICATION HSL 2013

Sparse LU Factorization for Parallel Circuit Simulation on GPUs

A Frontal Code for the Solution of Sparse Positive-Definite Symmetric Systems Arising from Finite-Element Applications

arxiv: v1 [math.oc] 30 Jan 2013

An Out-of-Core Sparse Cholesky Solver

REDUCING THE TOTAL BANDWIDTH OF A SPARSE UNSYMMETRIC MATRIX

AMS /672: Graph Theory Homework Problems - Week V. Problems to be handed in on Wednesday, March 2: 6, 8, 9, 11, 12.

Reducing the total bandwidth of a sparse unsymmetric matrix

NAG Library Routine Document E04GBF.1

Chapter 7. Network Flow. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

NAG Fortran Library Routine Document F11ZPF.1

NAG Library Routine Document F08LEF (DGBBRD)

F02WUF NAG Fortran Library Routine Document

MA36. All use is subject to licence. MA36 v Documentation date: 8th February SUMMARY 2 HOW TO USE THE PACKAGE

A Parallel Matrix Scaling Algorithm

Matrix Multiplication

Programming Languages

Stabilized block diagonal forms for parallel sparse solvers

Matrix Multiplication

Sparse Matrices Introduction to sparse matrices and direct methods

All use is subject to licence. See For any commercial application, a separate license must be signed.

AMD Version 1.2 User Guide

User Guide for GLU V2.0

A Comparison of Frontal Software with

Fortran 2008: what s in it for high-performance computing

NAG Library Chapter Introduction. F16 Further Linear Algebra Support Routines

NAG Fortran Library Routine Document E01AEF.1

E04FDFP.1. NAG Parallel Library Routine Document

Sparse Matrices Direct methods

Native mesh ordering with Scotch 4.0

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #16 Loops: Matrix Using Nested for Loop

Problem Set 4: Streams and Lazy Evaluation

NAG Fortran Library Routine Document F08KAF (DGELSS).1

Introductory Remarks

NAG Fortran Library Routine Document G05LZF.1

Project Report. 1 Abstract. 2 Algorithms. 2.1 Gaussian elimination without partial pivoting. 2.2 Gaussian elimination with partial pivoting

Optimizing Parallel Sparse Matrix-Vector Multiplication by Corner Partitioning

PACKAGE SPECIFICATION HSL 2013

Libraries for Scientific Computing: an overview and introduction to HSL

This PDF is a selection from an out-of-print volume from the National Bureau of Economic Research

NAG Library Function Document nag_superlu_lu_factorize (f11mec)

2. True or false: even though BFS and DFS have the same space complexity, they do not always have the same worst case asymptotic time complexity.

HSL MA79 1 SUMMARY 2 HOW TO USE THE PACKAGE. All use is subject to licence. 1 PACKAGE SPECIFICATION HSL 2013

Mathematical and Algorithmic Foundations Linear Programming and Matchings

printf("\n\nx = "); for(i=0;i<5;i++) printf("\n%f %f", X[i],X[i+5]); printf("\n\ny = "); for(i=0;i<5;i++) printf("\n%f", Y[i]);

GRAPH THEORY and APPLICATIONS. Factorization Domination Indepence Clique

Module 5.5: nag sym bnd lin sys Symmetric Banded Systems of Linear Equations. Contents

ATLAS (Automatically Tuned Linear Algebra Software),

nag kalman sqrt filt cov var (g13eac)

Obtaining triangular diagonal blocks. in sparse matrices using cutsets

NAG Fortran Library Routine Document F07AAF (DGESV).1

Computing the Block Triangular Form of a Sparse Matrix

Null space computation of sparse singular matrices with MUMPS

2.0 MATLAB Fundamentals

NAG Library Routine Document F07MAF (DSYSV).1

The block triangular form and bipartite matchings

NAG Fortran Library Routine Document F04JAF.1

NAG Fortran Library Routine Document F11DSF.1

For example, the system. 22 may be represented by the augmented matrix

Functions. Systems Programming Concepts

Improving Performance of Sparse Matrix-Vector Multiplication

Chapter 4. Matrix and Vector Operations

A Robust and Efficient Motion Segmentation Based on Orthogonal Projection Matrix of Shape Space

NAG Fortran Library Routine Document F04CAF.1

NAG Fortran Library Routine Document F04JGF.1

NAG Fortran Library Routine Document F04DHF.1

Sparse Direct Solvers for Extreme-Scale Computing

NAG Library Routine Document F04MCF.1

Computer Programming: C++

Solving problems on graph algorithms

Package exporkit. R topics documented: May 5, Type Package Title Expokit in R Version Date

Sparse matrices: Basics

Transcription:

MC64 PACKAGE SPECIFICATION HSL 2013 1 SUMMARY Given a sparse matrix A = {a ij} n n, this subroutine attempts to find a column permutation vector that makes the permuted matrix have n entries on its diagonal. If the matrix is structurally nonsingular, the subroutine optionally returns a column permutation that maximizes the smallest element on the diagonal, maximizes the sum of the diagonal entries, or maximizes the product of the diagonal entries of the permuted matrix. For the latter option, the subroutine also finds scaling factors that may be used to scale the original matrix so that the nonzero diagonal entries of the permuted and scaled matrix are one in absolute value and all the off-diagonal entries are less than or equal to one in absolute value. The natural logarithms of the scaling factors u i, i = 1,..., n, for the rows and v j, j = 1,..., n, for the columns are returned so that the scaled matrix B = {b } has entries ij n n b = a exp(u + v ). ij ij i j ATTRIBUTES Version: 1.6.0. Types: Real (single, double). Calls: MC21. Original date: July 1999. Origin: I. S. Duff and J. Koster (Rutherford Appleton Laboratory). Language: Fortran 77. 2 HOW TO USE THE PACKAGE 2.1.1 To set default values of controlling parameters If non-default values for any of the control parameters are required, they should be set immediately after the call to MC64I/ID. The single precision version CALL MC64I(ICNTL) The double precision version CALL MC64ID(ICNTL) ICNTL is an INTEGER array of length 10 that need not be set by the user. On return it contains default values. ICNTL(1) specifies the output stream for error messages. If ICNTL(1) < 0, these messages are suppressed. The default value, set by MC64I/ID, is 6. ICNTL(2) specifies the output stream for warning messages. If ICNTL(2) < 0, these messages are suppressed. The default value, set by MC64I/ID, is 6. ICNTL(3) specifies the output stream for diagnostic messages. If ICNTL(3) < 0, these messages are suppressed. The default value, set by MC64I/ID, is -1. ICNTL(4) specifies whether the input data is checked for out-of-range indices and duplicates. The default value of 0, set by MC64I/ID, will invoke data checking. These checks will not be performed if ICNTL(4) is set to any other value. MC64A/AD will run faster without the checking but, if either out-of-range indices or duplicates are present, it may fail so the user must be sure of the data before changing the default. ICNTL(5) to ICNTL(10) are not currently used but are set to zero by MC64I/ID. http://www.hsl.rl.ac.uk/ 1 Documentation date: 26th March 2013

MC64 HSL 2013 2.1.2 To find the column permutation (and possibly a scaling) The single precision version CALL MC64A(JOB,N,NE,IP,IRN,A,NUM,CPERM,LIW,IW,LDW,DW,ICNTL,INFO) The double precision version JOB N NE IP IRN A NUM CALL MC64AD(JOB,N,NE,IP,IRN,A,NUM,CPERM,LIW,IW,LDW,DW,ICNTL,INFO) is an INTEGER variable that must be set by the user to control the action. It is not altered by the subroutine. Possible values for JOB are: 1 Compute a column permutation of the matrix so that the permuted matrix has as many entries on its diagonal as possible. The values on the diagonal are of arbitrary size. 2 Compute a column permutation of the matrix so that the smallest value on the diagonal of the permuted matrix is maximized. 3 Compute a column permutation of the matrix so that the smallest value on the diagonal of the permuted matrix is maximized. The algorithm differs from the one used for JOB = 2 and may have quite a different performance. (See Section 4). 4 Compute a column permutation of the matrix so that the sum of the diagonal entries of the permuted matrix is maximized. 5 Compute a column permutation of the matrix so that the product of the diagonal entries of the permuted matrix is maximized. Vectors are also computed to scale the matrix so that the nonzero diagonal entries of the permuted matrix are one in absolute value and all the off-diagonal entries are less than or equal to one in absolute value. Restriction: 1 JOB 5. is an INTEGER variable that must be set by the user to the order of the matrix. It is not altered by the subroutine. Restriction: N 1. is an INTEGER variable that must be set by the user to the number of entries in the matrix. It is not altered by the subroutine. Restriction: NE 1. is an INTEGER array of length N+1. The user must set IP(J) to contain the position in array IRN of the first row index of an entry in column J, for J = 1,..., N. IP(N+1) must be set to NE+1. It is not altered by the subroutine. is an INTEGER array of length NE. The user must set IRN to hold the row indices of the entries of the matrix. Those belonging to column J must be stored contiguously in the positions IP(J),..., IP(J+1) 1. The ordering of the row indices within each column is unimportant. Repeated entries are not allowed. The array IRN is not altered by the subroutine. is a REAL (DOUBLE PRECISION in the D version) array of length NE. The user must set A(K) to the value of the entry that corresponds to IRN(K), K = 1,..., NE. It is not used by the subroutine when JOB = 1. It is not altered by the subroutine. is an INTEGER variable that need not be set by the user. On successful exit, NUM will be the number of entries on the diagonal of the permuted matrix. If NUM is less than N, the matrix is structurally singular. For an example of this, see Section 2.2. CPERM is an INTEGER array of length N that need not be set by the user. On successful exit, ABS(CPERM) contains the column permutation. If the matrix is structurally singular (NUM < N), then the entries of CPERM for which there is no entry on the diagonal of the permuted matrix are set negative. Column ABS(CPERM(J)) of the original matrix is column J in the permuted matrix, J = 1,..., N. LIW is an INTEGER variable that must be set by the user to the dimension of array IW. It is not altered by the subroutine. http://www.hsl.rl.ac.uk/ 2 Documentation date: 26th March 2013

HSL 2013 MC64 IW LDW DW Restriction: JOB = 1 : LIW 5N. JOB = 2 : LIW 4N. JOB = 3 : LIW 10N+NE. JOB = 4 : LIW 5N. JOB = 5 : LIW 5N. is an INTEGER array of length LIW that is used for workspace. is an INTEGER variable that must be set by the user to the dimension of array DW. It is not altered by the subroutine. Restriction: JOB = 1 : LDW is not used. JOB = 2 : LDW N. JOB = 3 : LDW NE. JOB = 4 : LDW 2N+NE. JOB = 5 : LDW 3N+NE. is a REAL (DOUBLE PRECISION in the D version) array of length LDW that is used for workspace. It is not used by the subroutine when JOB = 1. If JOB = 5, on return, DW(I) contains u I, I = 1,..., N, and DW(N+J) contains v J, J = 1,..., N. The column scaling factors v J apply to the original matrix, not to the permuted matrix. ICNTL is an INTEGER array of length 10. Its components control the output of MC64A/AD and must be set by the user before calling MC64A/AD. Default values can be set by calling MC64I/ID. The components are defined as in Section 2.1.1. ICNTL(5) to ICNTL(10) are not currently accessed by MC64A/AD. ICNTL is not altered by the subroutine. INFO is an INTEGER array of length 10 that need not be set by the user. INFO(1) is set non-negative to indicate success. A negative value is returned if an error occurred, a positive value if a warning occurred. If INFO(1) < 0, then further information on the error is given in INFO(2). On exit from the subroutine, INFO(1) will take one of the following values: 0 successful entry (for a structurally nonsingular matrix). +1 successful entry (for a structurally singular matrix). +2 the returned scaling factors are large and may cause overflow when used to scale the matrix. (For JOB = 5 entry only.) 1 JOB < 1 or JOB > 5. Value of JOB held in INFO(2). 2 N < 1. Value of N held in INFO(2). 3 NE < 1. Value of NE held in INFO(2). 4 the defined length LIW violates the restriction on LIW. Value of LIW required given by INFO(2). 5 the defined length LDW violates the restriction on LDW. Value of LDW required given by INFO(2). 6 an entry is found whose row index is out of range. INFO(2) contains the index of a column in which such an entry is found. 7 repeated entries are found. INFO(2) contains the index of a column in which such entries are found. INFO(3) to INFO(10) are not currently used but are set to zero by MC64A/AD. 2.2 Warning return The user may input a matrix that is structurally singular (for which there is no permutation that puts N entries onto the diagonal). An example of this is http://www.hsl.rl.ac.uk/ 3 Documentation date: 26th March 2013

MC64 HSL 2013 0 0 In such cases, MC64A/AD will return with a warning (INFO = 1) and a permutation that will put as many entries on the diagonal as possible (1 in the above example). The array ABS(CPERM) will still hold a permutation of the integers 1,..., N, but N-NUM of the pairs (I,ABS(CPERM(I))) are not entries in the matrix and the corresponding entry of CPERM will be negative. 3 GENERAL INFORMATION Other routines called directly: MC21A/AD. Subroutines internal to the package are MC64B/BD, MC64D/DD, MC64E/ED, MC64F/FD, MC64Q/QD, MC64R/RD, MC64S/SD, MC64U/UD, MC64W/WD. These subroutines need never be called directly by the user. Input/output: Restrictions: Output is under control of argument ICNTL. N 1, NE 1, 1 JOB 5. See also arguments LIW and LDW. 4 METHOD The algorithms used in the code and a discussion of its performance are given in detail in the report [4], and we give only a very brief summary here. Earlier work on these codes and a study of their use in solving systems by both iterative and direct methods is given in [3]. The algorithm that is used for JOB = 1 is MC21A/AD, a depth first search algorithm with look ahead technique [2]. The algorithm that is used for JOB = 2, solves a bottleneck bipartite matching problem. The algorithm starts with a partial matching and extends this by repeatedly searching the bipartite graph corresponding to the matrix for a path from an unmatched column node to any unmatched row node and for which the smallest weight of any edge in this path is maximal. The algorithm for JOB = 3 is based on repeated applications of an MC21 type algorithm to matrices A e obtained from the original n n matrix A by deleting those entries from A that are below a certain threshold value e. If a column permutation of cardinality n exists for A e, the threshold value e is increased otherwise e is decreased. This is repeated until e is such that a maximum matching of size n exists for matrix A e, but not for A e', where e' > e. This algorithm is described in detail in [3]. The algorithm that is used for JOB = 4 and 5, solves a weighted bipartite matching problem. The algorithm starts with a partial matching and extends this by repeatedly searching the corresponding bipartite graph for a path from an unmatched column node to any unmatched row node whose length is shortest. These paths are found using an algorithm similar to that of Dijkstra [1]. References [1] Dijkstra, E. W. (1959). A note on two problems in connection with graphs. Numerische Math. 1, 269-271. [2] Duff, I. S. (1981). Algorithm 575. Permutations for a zero-free diagonal. ACM Trans. Math. Softw. 7, 387-390. [3] Duff, I. S. and Koster, J. (1997). The design and use of algorithms for permuting large entries to the diagonal of sparse matrices. SIAM J. Matrix Anal. and Applics. 20, no. 4, 889-901. [4] Duff, I. S. and Koster, J. (1999). On algorithms for permuting large entries to the diagonal of sparse matrices. Report RAL-TR-1999-030, Rutherford Appleton Laboratory. http://www.hsl.rl.ac.uk/ 4 Documentation date: 26th March 2013

HSL 2013 MC64 5 EXAMPLE OF USE The following example reads a sparse matrix by columns and calls MC64AD to compute a column permutation for JOB = 1,..., 5. It subsequently uses the output for JOB = 5 to scale and permute the matrix so as to put entries with absolute value one on the diagonal and entries with absolute value at most one off the diagonal. INTEGER MAXN, MAXNE, LIW, LDW PARAMETER( MAXN=100, MAXNE=MAXN*MAXN, & LIW=10*MAXN+MAXNE, LDW=3*MAXN+MAXNE ) INTEGER ICNTL(10), INFO(10), I, J, JOB, K, N, NE, NUM, & IRN(MAXNE), LENC(MAXN), IP(MAXN), & RPERM(MAXN), CPERM(MAXN), IW(LIW) DOUBLE PRECISION A(MAXNE), DW(LDW) EXTERNAL MC64AD, MC22AD INTRINSIC EXP C Read matrix and set column pointers READ(5,*) N, NE IP(1) = 1 DO 10 J=1,N READ(5,*) LENC(J), & (IRN(K),A(K),K=IP(J),IP(J)+LENC(J)-1) IP(J+1) = IP(J) + LENC(J) 10 CONTINUE C Set default values for ICNTL CALL MC64ID(ICNTL) C Suppress error and warning messages ICNTL(1) = -1 ICNTL(2) = -1 C Compute matchings DO 20 JOB = 1,5 CALL MC64AD(JOB,N,NE,IP,IRN,A,NUM,CPERM,LIW,IW,LDW,DW,ICNTL,INFO) IF (INFO(1).LT.0) WRITE(6,'(A,I2)') & ' Error return from MC64A/AD, INFO(1) = ',INFO(1) WRITE(6,'(A,I1,A,4I2)') & ' For JOB = ',JOB,' the array CPERM() is: ',(CPERM(J),J=1,N) 20 CONTINUE C DW(1:N) contains row scaling, DW(N+1:2N) contains column scaling C Scale the matrix DO 25 J = 1,N DO 24 K = IP(J),IP(J+1)-1 I = IRN(K) A(K) = A(K) * EXP(DW(I) + DW(N+J)) 24 CONTINUE 25 CONTINUE C Put identity permutation in RPERM DO 30 J = 1,N RPERM(J) = J 30 CONTINUE C RPERM contains row permutation, CPERM contains column permutation C Permute the matrix with MC22A/AD CALL MC22AD(N,IRN,A,NE,LENC,CPERM,RPERM,IW(1),IW(2*N+1)) C Adjust column pointers according to the permutation IP(1) = 1 DO 40 J=1,N IP(J+1) = IP(J) + LENC(J) 40 CONTINUE C Write matrix WRITE(6,'(A)') ' The scaled and permuted matrix (JOB=5) is:' WRITE(6,'(2I4)') N, NE DO 50 J=1,N WRITE(6,'(I4,4(I6,F6.2))') LENC(J), http://www.hsl.rl.ac.uk/ 5 Documentation date: 26th March 2013

MC64 HSL 2013 & 50 CONTINUE STOP END Thus for the matrix (IRN(K),A(K),K=IP(J),IP(J)+LENC(J)-1) 3.00 5.00 2.00 3.00 0.00 3.00 4.00 6.00 1.00 2.00 4 10 3 3 3.00 1 3.00 2 2.00 2 1 5.00 2 3.00 2 4 1.00 3 4.00 3 2 0.00 3 6.00 4 2.00 and we would get the following output For JOB = 1 the array CPERM() is: 2 4 1 3 For JOB = 2 the array CPERM() is: 2 1 3 4 For JOB = 3 the array CPERM() is: 2 1 3 4 For JOB = 4 the array CPERM() is: 2 1 4 3 For JOB = 5 the array CPERM() is: 2 1 3 4 The scaled and permuted matrix (JOB=5) is: 4 10 2 1 1.00 2 0.90 3 3 1.00 1 1.00 2 1.00 2 4 0.75 3 1.00 3 2 0.00 3 1.00 4 1.00 The last five lines of this output represent the matrix 1.00 1.00 0.90 1.00 0.00. 1.00 1.00 1.00 0.75 1.00 we could have as input http://www.hsl.rl.ac.uk/ 6 Documentation date: 26th March 2013