c
c     Copyright (c) 1999,2000, Compaq Computer Corporation
c
c     See the file "license.terms" for information on usage and redistribution
c     of this file, and for a DISCLAIMER OF ALL WARRANTIES.
c
      subroutine surf_matrix_mult (n, left, right, result)
      implicit none
c      
      integer n
      real    left(n,n), right(n,n)
      real    result(n,n)
c
      integer i, j, k
      real sum
c      
      do j=1,n
         do i=1,n
            sum = 0.0
            do k=1,n
               sum = sum + left(i,k)*right(k,j)
            end do
            result(i,j) = sum
         end do
      end do       
      return
      end
c
      subroutine surf_vector_matrix_mult (n, vector, matrix, result)
      implicit none
c      
      integer n
      real    vector (n)
      real    matrix (n,n)
      real    result (n)
c
      integer i,j
      real sum
c
c     This multplication is with a transposed matrix,
c     in order to follow the original SURF code.
c
      do i=1,n
         sum = 0.0
         do j=1,n
            sum = sum + matrix(j,i)*vector(j)
         end do
         result(i) = sum
      end do
      return
      end
c
      subroutine surf_vector_vector_mult(n, left_row, right_col,
     1                                  result)
      implicit none
      
      integer n
      real    left_row(n)
      real    right_col(n)
      real    result
c
      real sum
      integer i
c
      sum = 0.0
      do i=1,n
         sum = sum + left_row(i) * right_col(i)
      end do
      result = sum
c
      return
      end

