!***********************************************************************
! ISPACK FORTRAN SUBROUTINE LIBRARY FOR SCIENTIFIC COMPUTING
! Copyright (C) 1998--2019 Keiichi Ishioka <ishioka@gfd-dennou.org>
!
! This library is free software; you can redistribute it and/or
! modify it under the terms of the GNU Lesser General Public
! License as published by the Free Software Foundation; either
! version 2.1 of the License, or (at your option) any later version.
!
! This library is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
! Lesser General Public License for more details.
! 
! You should have received a copy of the GNU Lesser General Public
! License along with this library; if not, write to the Free Software
! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
! 02110-1301 USA.
!***********************************************************************
SUBROUTINE SXCLAM(MM,NT,S,SL,D,IFLAG,MI)

  IMPLICIT NONE
  INTEGER(8) :: MM,NT,L,IFLAG,MI
  REAL(8) :: S((MM/MI+1)*(2*(NT+1)-MM/MI*MI))
  REAL(8) :: SL((MM/MI+1)*(2*(NT+1)-MM/MI*MI))
  REAL(8) :: D((MM/MI+1)*(2*(NT+1)-MM/MI*MI),2)
  INTEGER(8) :: NPMAX

  CALL MXGOMP(NPMAX)  

  !$omp parallel do num_threads(NPMAX)
  DO L=1,(MM/MI+1)*(2*(NT+1)-MM/MI*MI)
     SL(L)=D(L,IFLAG)*S(L)
  END DO
  !$omp end parallel do

END SUBROUTINE SXCLAM
