      SUBROUTINE CSE(N,SMAT,ROUTIN)
C
C     ########################################################################
C
C     Valerio Cappellini                                            April 2007
C
C     USES :: rgnf_lux, GinUE, Haar_U_N
C     COMPATIBILITY :: Fortran 90
C     VERSION :: 1.0.0
C
C     Produces 2N x 2N CPLX Random Unitary matrices from the Dyson's Circular
C     Symplectic Ensemble [CSE]. The code take N as imput and give as 
C     output a Random Matrix SMAT at each call.
C
C     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C
C     ROUTIN   : Name of the subroutine you are going to use for generating
C                the random numbers (suggested :: rgnf_lux.f)
C
C     IMPORTANT [1] !!! Remember to initialize the Subroutine rgnf_lux.f
C                       by means of "Call Ranset_()"
C     IMPORTANT [2] !!! Remember to put the file "i_seed_rng" into the 
C                       working directory.
C     IMPORTANT [3] !!! Remember to insert main_program: "EXTERNAL rgnf_lux"
C
C     ########################################################################
C
$     debug
      INTEGER N, emme, mu
      COMPLEX SMAT(2*N,2*N),A(2*N,2*N),B(2*N,2*N),C(2*N,2*N),Id(2*N,2*N)

      EXTERNAL ROUTIN

      call Haar_U_N(2*N,A,ROUTIN)

      Do i=1,n
          Do j=1,2*n
              Id(2*i-1,j)=(0.,0.)
              Id(2*i,j)=(0.,0.)
          Enddo
          Id(2*i-1,2*i)=( 1.,0.)
          Id(2*i,2*i-1)=(-1.,0.)
      Enddo               

      B = TRANSPOSE(A)
      C = MATMUL(A,Id)
      A = MATMUL(C,B)
      SMAT = MATMUL(A,Id)

      RETURN
      END
