Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-02 - decus/20-0026/perm.doc
There are 2 other files named perm.doc in the archive. Click here to see a list.
SUBROUTINE PERM

PURPOSE
   TO COMPUTE THE PERMUTATION VECTOR THAT IS INVERSE TO A GIVEN
   PERMUTATION VECTOR, THE PERMUTATION VECTOR THAT IS EQUIVA-
   LENT TO A GIVEN TRANSPOSITION VECTOR AND A TRANSPOSITION
   VECTOR THAT IS EQUIVALENT TO A GIVEN PERMUTATION VECTOR.
   (SEE THE GENERAL DISCUSSION FOR DEFINITIONS AND NOTATION.)

USAGE
   CALL PERM(IP1,IP2,N,IPAR,IER)

DESCRIPTION OF PARAMETERS
   IP1	- GIVEN PERMUTATION OR TRANSPOSITION VECTOR
	  (DIMENSION N)
   IP2	- RESULTING PERMUTATION OR TRANSPOSITION VECTOR
	  (DIMENSION N)
   N	- DIMENSION OF VECTORS IP1 AND IP2
   IPAR - INPUT PARAMETER
	  IPAR NEGATIVE - COMPUTE THE PERMUTATION VECTOR IP2
			  THAT IS THE INVERSE OF THE PERMUTA-
			  TION VECTOR IP1
	  IPAR	=  ZERO - COMPUTE THE PERMUTATION VECTOR IP2
			  THAT IS EQUIVALENT TO THE TRANSPOSI-
			  TION VECTOR IP1
	  IPAR POSITIVE - COMPUTE A TRANSPOSITION VECTOR IP2
			  THAT IS EQUIVALENT TO THE PERMUTATION
			  VECTOR IP1
   IER	- RESULTING ERROR PARAMETER
	  IER=-1  -  N IS NOT POSITIVE
	  IER= 0  -  NO ERROR
	  IER= 1  -  IP1 IS EITHER NOT A PERMUTATION VECTOR OR
		     NOT A TRANSPOSITION VECTOR ON 1,...,N,
		     DEPENDING ON WHETHER IPAR IS NON-ZERO OR
		     ZERO, RESPECTIVELY

REMARKS
   (1)	IF IER=-1 THERE HAS BEEN NO COMPUTATION.
   (2)	IF IER=1, THEN COMPUTATION HAS BEEN UNSUCCESSFUL DUE TO
	ERROR AND THE PARTIAL RESULTS FOUND IN IP2 ARE USELESS.
   (3)	IP2 CANNOT HAVE THE SAME STORAGE ALLOCATION AS IP1.

SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
   NONE

METHOD
   (1)	IPAR NEGATIVE - FOR EACH I, I=1,...,N, IP2(IP1(I)) IS
			SET TO I.
   (2)	IPAR  =  ZERO - INITIALLY IP2(I) IS SET TO I FOR
			I=1,...,N.  THEN, FOR I=1,...,N IN THAT
			ORDER, IP2(I) AND IP2(IP1(I)) ARE
			INTERCHANGED.
   (3)	IPAR POSITIVE - INITIALLY IP1 IS MOVED TO IP2.	THEN
			THE FOLLOWING TWO STEPS ARE REPEATED
			FOR I SUCCESSIVELY EQUAL TO 1,...,N.
			(A) FIND THE SMALLEST J GREATER THAN OR
			    EQUAL TO I SUCH THAT IP2(J)=I.
			(B) SET IP2(J) TO IP2(I).