/*
#===============================================================================
#
# spin_dcmp.h
#
#-------------------------------------------------------------------------------
#
# Copyright (C) 2008-2010 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/>.
#
#-------------------------------------------------------------------------------
*/

#define its(c) cmplx(-aimag(c), real(c), kind = RKIND)

#define _dcmp_1_p_gamma1(out, in, c, i)\
  out(1) = in(1, c, i) - its(in(4, c, i));n\
  out(2) = in(2, c, i) - its(in(3, c, i));n\
  out(3) = its(out(2));n\
  out(4) = its(out(1))
#define _dcmp_1_m_gamma1(out, in, c, i)	\
  out(1) = in(1, c, i) + its(in(4, c, i));\
  out(2) = in(2, c, i) + its(in(3, c, i));\
  out(3) =-its(out(2));\
  out(4) =-its(out(1))

#define _dcmp_1_p_gamma2(out, in, c, i)\
  out(1) = in(1, c, i) - in(4, c, i);\
  out(2) = in(2, c, i) + in(3, c, i);\
  out(3) =  out(2);\
  out(4) = -out(1)
#define _dcmp_1_m_gamma2(out, in, c, i)\
  out(1) = in(1, c, i) + in(4, c, i);\
  out(2) = in(2, c, i) - in(3, c, i);\
  out(3) =-out(2);\
  out(4) = out(1)

#define _dcmp_1_p_gamma3(out, in, c, i)\
  out(1) = in(1, c, i) - its(in(3, c, i));\
  out(2) = in(2, c, i) + its(in(4, c, i));\
  out(3) = its(out(1));\
  out(4) =-its(out(2))
#define _dcmp_1_m_gamma3(out, in, c, i)\
  out(1) = in(1, c, i) + its(in(3, c, i));\
  out(2) = in(2, c, i) - its(in(4, c, i));\
  out(3) =-its(out(1));\
  out(4) = its(out(2))

#define _dcmp_1_p_gammac(out, in, c, i)\
  out(1) = in(1, c, i) + in(3, c, i);\
  out(2) = in(2, c, i) + in(4, c, i);\
  out(3) = out(1);\
  out(4) = out(2)
#define _dcmp_1_m_gammac(out, in, c, i)\
  out(1) = in(1, c, i) - in(3, c, i);\
  out(2) = in(2, c, i) - in(4, c, i);\
  out(3) =-out(1);\
  out(4) =-out(2)

#define _dcmp_1_p_gamman(out, in, c, i)\
  out(1) = 2 * in(1, c, i);\
  out(2) = 2 * in(2, c, i);\
  out(3) = 0;\
  out(4) = 0
#define _dcmp_1_m_gamman(out, in, c, i)\
  out(1) = 0;\
  out(2) = 0;\
  out(3) = 2 * in(3, c, i);\
  out(4) = 2 * in(4, c, i)
