dperm
C DPERM SOURCE CHAT 05/01/12 22:54:41 5004 IMPLICIT INTEGER(I-N) IMPLICIT REAL*8 (A-H,O-Z) C*********************************************************************** C NOM : DPERM C DESCRIPTION : Permutation (lignes et colonnes) d'une matrice Morse. C C C LANGAGE : FORTRAN 77 C ADAPTATION : Stéphane GOUNAND (CEA/DRN/DMT/SEMT/LTMF) C mél : gounand@semt2.smts.cea.fr C AUTEUR : C Sparskit : a basic tool kit for sparse matrix computations C Version 2 (Youcef Saad) C -> URL : http://www.cs.umn.edu/Research/arpa/SPARSKIT/sparskit.html C C*********************************************************************** INTEGER NROW,JA(*),IA(NROW+1),JAO(*),IAO(NROW+1),PERM(NROW), + QPERM(*),JOB REAL*8 A(*),AO(*) c----------------------------------------------------------------------- c This routine permutes the rows and columns of a matrix stored in CSR c format. i.e., it computes P A Q, where P, Q are permutation matrices. c P maps row i into row perm(i) and Q maps column j into column qperm(j): c a(i,j) becomes a(perm(i),qperm(j)) in new matrix c In the particular case where Q is the transpose of P (symmetric c permutation of A) then qperm is not needed. c note that qperm should be of length ncol (number of columns) but this c is not checked. c----------------------------------------------------------------------- c Y. Saad, Sep. 21 1989 / recoded Jan. 28 1991. c----------------------------------------------------------------------- c on entry: c---------- c n = dimension of the matrix c a, ja, c ia = input matrix in a, ja, ia format c perm = integer array of length n containing the permutation arrays c for the rows: perm(i) is the destination of row i in the c permuted matrix -- also the destination of column i in case c permutation is symmetric (job .le. 2) c c qperm = same thing for the columns. This should be provided only c if job=3 or job=4, i.e., only in the case of a nonsymmetric c permutation of rows and columns. Otherwise qperm is a dummy c c job = integer indicating the work to be done: c * job = 1,2 permutation is symmetric Ao :== P * A * transp(P) c job = 1 permute a, ja, ia into ao, jao, iao c job = 2 permute matrix ignoring real values. c * job = 3,4 permutation is non-symmetric Ao :== P * A * Q c job = 3 permute a, ja, ia into ao, jao, iao c job = 4 permute matrix ignoring real values. c c on return: c----------- c ao, jao, iao = input matrix in a, ja, ia format c c in case job .eq. 2 or job .eq. 4, a and ao are never referred to c and can be dummy arguments. c Notes: c------- c 1) algorithm is in place (Faux ! vu que RPERM ne l'est pas) c 2) column indices may not be sorted on return even though they may be c on entry. c----------------------------------------------------------------------c c local variables INTEGER LOCJOB, MOD c c locjob indicates whether or not real values must be copied. c LOCJOB = MOD(JOB,2) c c permute rows first c c c then permute columns c LOCJOB = 0 c IF (JOB .LE. 2) THEN ELSE ENDIF c RETURN c-------end-of-dperm---------------------------------------------------- c----------------------------------------------------------------------- END
© Cast3M 2003 - Tous droits réservés.
Mentions légales