      subroutine readmatrix(a,n,m,unit)
      integer n,m,unit
      real a(50,50)
      Do i=1,n
      read (unit,*)  (a(i,j),j=1,m)
      end do

      end subroutine

      

      subroutine displaymatrix(a,n,m)
      integer n,m,unit
      real a(50,50)
      Do i=1,n
      write (6,100)  (a(i,j),j=1,m)
      end do
 100  Format (5(2x,f10.5))
      end subroutine

      subroutine readvektor(a,n,unit)
      integer n, unit
      real a(50)
      read (unit,*)  (a(j),j=1,n)
      end subroutine

      subroutine displayvektor(a,n)
      integer n
      real a(50)
      write (6,*)  (a(j),j=1,n)
      end subroutine

      subroutine readline(unit)
      integer unit
      read (unit,*) 
      end subroutine



      subroutine multMatrixVector(a,b,c,n,m)
      integer n,m
      real a(50,50),b(50),c(50)
c      Dimension  b(),c(20)
c      Dimension a(20,20)

      do i=1,n
         c(i)=0.0
         do j=1,m
            c(i)=c(i)+a(i,j)*b(j)
         end do
      end do
      end subroutine

      subroutine multMatrixMatrix(MA1,MA2,XMM,n1,m1,n2,m2)
      INTEGER n1,m1,m2,n2,i,j,k
      REAL MA1(50,50),MA2(50,50),XMM(50,50)
c      Dimension MA1(20,20),MA2(20,20),XMM(20,20)

      Do i=1,n1
         Do j=1,m2
            XMM(i,j) = 0.0
            Do k=1,m1
               XMM(i,j) = XMM(i,j) + MA1(i,k)*MA2(k,j)
            End Do
         End Do
      End Do
      end subroutine
