home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
fortran
/
library
/
ssp
/
polyops
/
pmpy.for
< prev
next >
Wrap
Text File
|
1985-11-29
|
2KB
|
53 lines
C
C ..................................................................
C
C SUBROUTINE PMPY
C
C PURPOSE
C MULTIPLY TWO POLYNOMIALS
C
C USAGE
C CALL PMPY(Z,IDIMZ,X,IDIMX,Y,IDIMY)
C
C DESCRIPTION OF PARAMETERS
C Z - VECTOR OF RESULTANT COEFFICIENTS, ORDERED FROM
C SMALLEST TO LARGEST POWER
C IDIMZ - DIMENSION OF Z (CALCULATED)
C X - VECTOR OF COEFFICIENTS FOR FIRST POLYNOMIAL, ORDERED
C FROM SMALLEST TO LARGEST POWER
C IDIMX - DIMENSION OF X (DEGREE IS IDIMX-1)
C Y - VECTOR OF COEFFICIENTS FOR SECOND POLYNOMIAL,
C ORDERED FROM SMALLEST TO LARGEST POWER
C IDIMY - DIMENSION OF Y (DEGREE IS IDIMY-1)
C
C REMARKS
C Z CANNOT BE IN THE SAME LOCATION AS X
C Z CANNOT BE IN THE SAME LOCATION AS Y
C
C SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C NONE
C
C METHOD
C DIMENSION OF Z IS CALCULATED AS IDIMX+IDIMY-1
C THE COEFFICIENTS OF Z ARE CALCULATED AS SUM OF PRODUCTS
C OF COEFFICIENTS OF X AND Y , WHOSE EXPONENTS ADD UP TO THE
C CORRESPONDING EXPONENT OF Z.
C
C ..................................................................
C
SUBROUTINE PMPY(Z,IDIMZ,X,IDIMX,Y,IDIMY)
DIMENSION Z(1),X(1),Y(1)
C
IF(IDIMX*IDIMY)10,10,20
10 IDIMZ=0
GO TO 50
20 IDIMZ=IDIMX+IDIMY-1
DO 30 I=1,IDIMZ
30 Z(I)=0.
DO 40 I=1,IDIMX
DO 40 J=1,IDIMY
K=I+J-1
40 Z(K)=X(I)*Y(J)+Z(K)
50 RETURN
END