C	MTMPYD.F4 IS A SAMPLE PROGRAM, WHEN USED IN CONJUNCTION
C	WITH MTMPY(LOADED AND SAVED AS MTMPYD.SAV) WILL
C	ILLUSTRATE THE USE OF MTMPY.
      SUBROUTINE MTMPY(IND,A,B,C,LARG,MARG,N)
	DIMENSION A(25,25), B(25,25), C(25,25)
	L = IABS(LARG)
	M = IABS(MARG)
      I=IND+1
      GO TO (101,201,301,401),I
101   DO 121 J1=1,L
      DO 121 J2=1,N
      C(J1,J2)=0.0
      DO 121 J3=1,M
	IF(LARG)110,5001,108
  108	IF(MARG)105,5001,106
  106	TEMP = A(J1,J3) * B(J3,J2)
      GO TO 121
105   TEMP=A(J1,J3)*B(J2,J3)
      GO TO 121
  110	IF(MARG)115,5001,112
  112	TEMP = A(J3,J1) * B(J3,J2)
      GO TO 121
115   TEMP=A(J3,J1)*B(J2,J3)
121   C(J1,J2)=C(J1,J2)+TEMP
      GO TO 5001
201   DO 221 J1=1,L
221   C(J1,1)=A(J1,1)*B(J1,1)
      GO TO 5001
301   DO 321 J1=1,L
      DO 321 J2=1,M
	IF(MARG)315,5001,310
  310	TEMP = A(J1,1) * B(J1,J2)
      GO TO 321
315   TEMP=A(J1,1)*B(J2,J1)
321   C(J1,J2)=TEMP
      GO TO 5001
401   DO 421 J1=1,L
      DO 421 J2=1,M
	IF(LARG)415,5001,410
  410	TEMP = A(J1,J2) * B(J2,1)
      GO TO 421
415   TEMP=A(J2,J1)*B(J2,1)
421   C(J1,J2)=TEMP
5001  RETURN
      END

