!===============================================================================
!
! sc_spincol_field.F90  -  linear algebra for the Spin-Colour field
!
!-------------------------------------------------------------------------------
!
! Copyright (C) 2006 Yoshifumi Nakamura
!
! This file is part of BQCD -- Berlin Quantum ChromoDynamics program
!
! BQCD is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! BQCD 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 General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with BQCD.  If not, see <http://www.gnu.org/licenses/>.
!
!-------------------------------------------------------------------------------
! Added 'sc_cxpby' for PFHMC
!
! Editor: Taylor Haar
! Last modified: 03/12/2014
!-------------------------------------------------------------------------------
# include "defs.h"

!-------------------------------------------------------------------------------
subroutine sc_zero_spincol_field(out)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(out) :: out

  call sc_zero(out)

end

!-------------------------------------------------------------------------------
subroutine sc_copy_spincol_field(out, in)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(out) :: out
  SPINCOL_FIELD, intent(in) :: in

  call sc_copy(out, in)

end

!-------------------------------------------------------------------------------
subroutine sc_scale_spincol_field(inout, factor)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(inout) :: inout
  REAL, intent(in)    :: factor

  call sc_scale(inout, factor)

end

!-------------------------------------------------------------------------------
subroutine sc_cscale_spincol_field(inout, factor)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(inout) :: inout
  COMPLEX, intent(in)    :: factor

  call sc_cscale(inout, factor)

end

!-------------------------------------------------------------------------------
subroutine sc_cax2_spincol_field(out, in1, a1, in2, a2)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(out) :: out
  SPINCOL_FIELD, intent(in) :: in1, in2
  COMPLEX, intent(in)  :: a1, a2

  call sc_cax2(out, in1, a1, in2, a2)

end

!-------------------------------------------------------------------------------
subroutine sc_axpy_spincol_field(inout, in, a)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(inout) :: inout
  SPINCOL_FIELD, intent(in) :: in
  REAL, intent(in)    :: a

  call sc_axpy(inout, in, a)

end

!-------------------------------------------------------------------------------
subroutine sc_caxpy_spincol_field(inout, in, a)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(inout) :: inout
  SPINCOL_FIELD, intent(in) :: in
  COMPLEX, intent(in)    :: a

  call sc_caxpy(inout, in, a)

end

!-------------------------------------------------------------------------------
subroutine sc_cxpby_spincol_field(inout, in, b)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(inout) :: inout
  SPINCOL_FIELD, intent(in) :: in
  COMPLEX, intent(in)    :: b

  call sc_cxpby(inout, in, b)

end

!-------------------------------------------------------------------------------
subroutine sc_caxpy2_spincol_field(inout, in1, a1, in2, a2)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(inout) :: inout
  SPINCOL_FIELD, intent(in) :: in1, in2
  COMPLEX, intent(in)    :: a1, a2

  call sc_caxpy2(inout, in1, a1, in2, a2)

end

!-------------------------------------------------------------------------------
subroutine sc_xpby_spincol_field(inout, in, b)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(inout) :: inout
  SPINCOL_FIELD, intent(in) :: in
  REAL, intent(in)    :: b

  call sc_xpby(inout, in, b)

end

!-------------------------------------------------------------------------------
subroutine sc_axpby_spincol_field(inout, in, b, a)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(inout) :: inout
  SPINCOL_FIELD, intent(in) :: in
  REAL, intent(in)    :: b, a

  call sc_axpby(inout, in, b, a)

end

!-------------------------------------------------------------------------------
subroutine sc_caxpby_spincol_field(inout, in, b, a)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(inout) :: inout
  SPINCOL_FIELD, intent(in) :: in
  COMPLEX, intent(in)    :: b, a

  call sc_caxpby(inout, in, b, a)

end

!-------------------------------------------------------------------------------
REAL function sc_norm2_spincol_field(in)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(in) :: in
  REAL, external :: sc_norm2

  sc_norm2_spincol_field = sc_norm2(in)

end

!-------------------------------------------------------------------------------
REAL function sc_dot_spincol_field(x, y)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(in) :: x, y
  REAL, external :: sc_dot

  sc_dot_spincol_field = sc_dot(x, y)

end

!-------------------------------------------------------------------------------
COMPLEX function sc_cdotc_spincol_field(x, y)
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(in) :: x, y
  COMPLEX, external :: sc_cdotc

  sc_cdotc_spincol_field = sc_cdotc(x, y)

end

!-------------------------------------------------------------------------------
subroutine sc_xmy_spincol_field(inout, in)  ! inout = - inout + in
  use module_vol
  implicit none
  SPINCOL_FIELD, intent(inout) :: inout
  SPINCOL_FIELD, intent(in) :: in

  call sc_xmy(inout, in)

end

!===============================================================================
