      SUBROUTINE TRIPLY(L,I,D,J,U,K,Y,LY,M,N)
      INTEGER M,N,I,J,K,LY
      REAL L(I,N),D(J,N),U(K,N),Y(LY,N)                                         
      INTEGER II,IM,IMTOP,MIN0,MAX0,MOD,ODDBIT,ITEMP                            
      IF(.NOT.(N.LE.0))GOTO 23114                                               
         RETURN                                                                 
23114 CONTINUE                                                                  
      ODDBIT = MOD(N-1,5)                                                       
      IMTOP=MIN0(N,1+ODDBIT)                                                    
      DO 23116 IM=2,IMTOP,1                                                     
         DO 23118 II=1,M                                                        
                  Y(II,IM)= Y(II,IM)- L(II,IM)* Y(II,IM-1)                      
23118       CONTINUE                                                            
23116    CONTINUE                                                               
      ITEMP=IMTOP+1                                                             
      DO 23120 IM=ITEMP,N,5                                                     
         DO 23122 II=1,M                                                        
                  Y(II,IM)= Y(II,IM)- L(II,IM)* Y(II,IM-1)                      
                  Y(II,IM+1)= Y(II,IM+1)- L(II,IM+1)* Y(II,IM)                  
                  Y(II,IM+2)= Y(II,IM+2)- L(II,IM+2)* Y(II,IM+1)                
                  Y(II,IM+3)= Y(II,IM+3)- L(II,IM+3)* Y(II,IM+2)                
                  Y(II,IM+4)= Y(II,IM+4)- L(II,IM+4)* Y(II,IM+3)                
23122       CONTINUE                                                            
23120    CONTINUE                                                               
#ifdef undef
      DO 23124 II=1,M                                                           
             Y(II,N)= Y(II,N)* D(II,N)                                          
23124    CONTINUE                                                               
      IMTOP=MAX0(1,N-ODDBIT)                                                    
      ITEMP=N-1                                                                 
      DO 23126 IM=ITEMP,IMTOP,-1                                                
         DO 23128 II=1,M                                                        
                 Y(II,IM)= Y(II,IM)* D(II,IM)- U(II,IM)* Y(II,IM+1)             
23128       CONTINUE                                                            
23126    CONTINUE                                                               
      ITEMP=IMTOP-1                                                             
      DO 23130 IM=ITEMP,1,-5                                                    
         DO 23132 II=1,M                                                        
             Y(II,IM)=Y(II,IM)* D(II,IM)- U(II,IM)* Y(II,IM+1)                  
             Y(II,IM-1)=Y(II,IM-1)*D(II,IM-1)-U(II,IM-1)*Y(II,IM)               
             Y(II,IM-2)=Y(II,IM-2)*D(II,IM-2)-U(II,IM-2)*Y(II,IM-1)             
             Y(II,IM-3)=Y(II,IM-3)*D(II,IM-3)-U(II,IM-3)*Y(II,IM-2)             
             Y(II,IM-4)=Y(II,IM-4)*D(II,IM-4)-U(II,IM-4)*Y(II,IM-3)             
23132     CONTINUE                                                              
23130    CONTINUE                                                               
#endif undef
      RETURN                                                                    
      END                                                                       
