home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
DOOG
/
PCSSP2.ZIP
/
POLYOPS.ZIP
/
PADDM.FOR
< prev
next >
Wrap
Text File
|
1985-11-29
|
2KB
|
63 lines
C
C ..................................................................
C
C SUBROUTINE PADDM
C
C PURPOSE
C ADD COEFFICIENTS OF ONE POLYNOMIAL TO THE PRODUCT OF A
C FACTOR BY COEFFICIENTS OF ANOTHER POLYNOMIAL
C
C USAGE
C CALL PADDM(Z,IDIMZ,X,IDIMX,FACT,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 FACT - FACTOR TO BE MULTIPLIED BY VECTOR Y
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 VECTOR Z MAY BE IN SAME LOCATION AS EITHER VECTOR X OR
C VECTOR Y ONLY IF THE DIMENSION OF THAT VECTOR IS NOT LESS
C THAN THE OTHER INPUT VECTOR
C THE RESULTANT POLYNOMIAL MAY HAVE TRAILING ZERO COEFFICIENTS
C
C SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C NONE
C
C METHOD
C DIMENSION OF RESULTANT VECTOR IDIMZ IS CALCULATED AS THE
C LARGER OF THE TWO INPUT VECTOR DIMENSIONS. COEFFICIENT IN
C VECTOR X IS THEN ADDED TO COEFFICIENT IN VECTOR Y MULTIPLIED
C BY FACTOR TO FORM Z.
C
C ..................................................................
C
SUBROUTINE PADDM(Z,IDIMZ,X,IDIMX,FACT,Y,IDIMY)
DIMENSION Z(1),X(1),Y(1)
C
C TEST DIMENSIONS OF SUMMANDS
C
NDIM=IDIMX
IF(IDIMX-IDIMY) 10,20,20
10 NDIM=IDIMY
20 IF(NDIM) 90,90,30
30 DO 80 I=1,NDIM
IF(I-IDIMX) 40,40,60
40 IF(I-IDIMY) 50,50,70
50 Z(I)=FACT*Y(I)+X(I)
GO TO 80
60 Z(I)=FACT*Y(I)
GO TO 80
70 Z(I)=X(I)
80 CONTINUE
90 IDIMZ=NDIM
RETURN
END