1 : C DPERM SOURCE CHAT 05/01/12 22:54:41 5004 2 : SUBROUTINE DPERM (NROW,A,JA,IA,AO,JAO,IAO,PERM,QPERM,JOB) 3 : IMPLICIT INTEGER(I-N) 4 : IMPLICIT REAL*8 (A-H,O-Z) 5 : C*********************************************************************** 6 : C NOM : DPERM 7 : C DESCRIPTION : Permutation (lignes et colonnes) d'une matrice Morse. 8 : C 9 : C 10 : C LANGAGE : FORTRAN 77 11 : C ADAPTATION : Stéphane GOUNAND (CEA/DRN/DMT/SEMT/LTMF) 12 : C mél : gounand@semt2.smts.cea.fr 13 : C AUTEUR : 14 : C Sparskit : a basic tool kit for sparse matrix computations 15 : C Version 2 (Youcef Saad) 16 : C -> URL : http://www.cs.umn.edu/Research/arpa/SPARSKIT/sparskit.html 17 : C 18 : C*********************************************************************** 19 : INTEGER NROW,JA(*),IA(NROW+1),JAO(*),IAO(NROW+1),PERM(NROW), 20 : + QPERM(*),JOB 21 : REAL*8 A(*),AO(*) 22 : c----------------------------------------------------------------------- 23 : c This routine permutes the rows and columns of a matrix stored in CSR 24 : c format. i.e., it computes P A Q, where P, Q are permutation matrices. 25 : c P maps row i into row perm(i) and Q maps column j into column qperm(j): 26 : c a(i,j) becomes a(perm(i),qperm(j)) in new matrix 27 : c In the particular case where Q is the transpose of P (symmetric 28 : c permutation of A) then qperm is not needed. 29 : c note that qperm should be of length ncol (number of columns) but this 30 : c is not checked. 31 : c----------------------------------------------------------------------- 32 : c Y. Saad, Sep. 21 1989 / recoded Jan. 28 1991. 33 : c----------------------------------------------------------------------- 34 : c on entry: 35 : c---------- 36 : c n = dimension of the matrix 37 : c a, ja, 38 : c ia = input matrix in a, ja, ia format 39 : c perm = integer array of length n containing the permutation arrays 40 : c for the rows: perm(i) is the destination of row i in the 41 : c permuted matrix -- also the destination of column i in case 42 : c permutation is symmetric (job .le. 2) 43 : c 44 : c qperm = same thing for the columns. This should be provided only 45 : c if job=3 or job=4, i.e., only in the case of a nonsymmetric 46 : c permutation of rows and columns. Otherwise qperm is a dummy 47 : c 48 : c job = integer indicating the work to be done: 49 : c * job = 1,2 permutation is symmetric Ao :== P * A * transp(P) 50 : c job = 1 permute a, ja, ia into ao, jao, iao 51 : c job = 2 permute matrix ignoring real values. 52 : c * job = 3,4 permutation is non-symmetric Ao :== P * A * Q 53 : c job = 3 permute a, ja, ia into ao, jao, iao 54 : c job = 4 permute matrix ignoring real values. 55 : c 56 : c on return: 57 : c----------- 58 : c ao, jao, iao = input matrix in a, ja, ia format 59 : c 60 : c in case job .eq. 2 or job .eq. 4, a and ao are never referred to 61 : c and can be dummy arguments. 62 : c Notes: 63 : c------- 64 : c 1) algorithm is in place (Faux ! vu que RPERM ne l'est pas) 65 : c 2) column indices may not be sorted on return even though they may be 66 : c on entry. 67 : c----------------------------------------------------------------------c 68 : c local variables 69 : INTEGER LOCJOB, MOD 70 : c 71 : c locjob indicates whether or not real values must be copied. 72 : c 73 : LOCJOB = MOD(JOB,2) 74 : c 75 : c permute rows first 76 : c 76 : CALL RPERM (NROW,A,JA,IA,AO,JAO,IAO,PERM,LOCJOB) 77 : c 78 : c then permute columns 79 : c 80 : LOCJOB = 0 81 : c 82 : IF (JOB .LE. 2) THEN 82 : CALL CPERM (NROW,AO,JAO,IAO,AO,JAO,IAO,PERM,LOCJOB) 83 : ELSE 83 : CALL CPERM (NROW,AO,JAO,IAO,AO,JAO,IAO,QPERM,LOCJOB) 84 : ENDIF 85 : c 86 : RETURN 87 : c-------end-of-dperm---------------------------------------------------- 88 : c----------------------------------------------------------------------- 89 : END 90 : 91 :
© Cast3M 2003 - All rights reserved.
Disclaimer