4#define _USE_MATH_DEFINES
7#include "Headers/LocalRandomMatrix.hpp"
8#include "Headers/matrix_util.hpp"
9#include "Headers/spin_int.hpp"
10#include "Headers/mersenne_twister.hpp"
17#define RANDTYPE argv[Nargs_common+0] << argv[Nargs_common+1] << "H_" << argv[Nargs_common+2] << argv[Nargs_common+3] << "Op"
18#define USAGE_sp "sp1.(Decay type of H) sp2.(Decay parameter for H) sp3.(Decay type of Op) sp4.(Decay parameter for Op) "
21static inline double Prefactor(
Integer_t const j, std::string
const Type,
double const param) {
22 if(Type ==
"Exp")
return exp( -(j-1)*param );
23 else if(Type ==
"Pow")
return pow(j,-param);
24 else if(Type ==
"Short")
return (j==1 ? 1: 0);
25 else if(Type ==
"Full")
return 1;
26 else if(Type ==
"CRMT")
return NAN;
28 std::cerr <<
"Usage: Decay type (argument 7) must be either \"Exp\", \"Pow\", \"Short\", \"Full\", or \"CRMT\"." << std::endl;
35static inline bool Initialize(
int const argc,
char const*
const* argv,
int const Nargs_common) {
38 std::string
const TypeH(argv[Nargs_common+0]);
39 double const paramH = atof(argv[Nargs_common+1]);
40 std::string
const TypeOp(argv[Nargs_common+2]);
41 double const paramOp = atof(argv[Nargs_common+3]);
48 prefactorH[n][j] = Prefactor(j, TypeH, paramH);
53 std::cout <<
"# Decay factor for Hamiltonians." << std::endl;
55 std::cout <<
"# Decay factor for observables." << std::endl;
60static inline bool Finalize(
int const argc,
char const*
const* argv) {
return true; }
66static inline void generateLocal_h(matrix<Complex_t>& mat,
Integer_t const d_lmat,
Integer_t const seed){
69 std::cout <<
"# init_genrand(" << seed <<
")\n";
71 RandomMatrix_GUE(mat, d_lmat);
73static inline void generateLocal_op(matrix<Complex_t>& mat,
Integer_t const d_lmat,
Integer_t const seed){
74 if(seed >= 0) init_genrand(seed);
75 generateLocal_h(mat, d_lmat, seed);
80static inline Integer_t constructGlobalOperator(matrix<Complex_t>& global, matrix<Complex_t>
const& local,
Integer_t const numLoc,
TransSector const&
Sector, std::vector<double>
const& factor,
void*
GPUconf =
nullptr) {
82 return SectorDimension(
Sector);
90 std::cout <<
"n=" <<
Sector.N() <<
"\n";
91 local.print(d_loch,d_loch);
93 std::cout <<
"\n" << std::endl;
109 for(trans1 = 0;trans1 <
Sector.periodicity(idx); ++trans1) {
111 for(trans2 = 0;trans2 <
Sector.periodicity(idy); ++trans2) {
115 for(pos = 1;pos<
Sector.N() && Ndiff<2; ++pos) {
120 for(diff = 1;diff <
Sector.N(); ++diff) {
123 res += factor.at(diff)*matLoc.at(locId1,locId2)*std::exp(I<>*theta);
129 res += factor.at(diff)*matLoc.at(locId1,locId2)*std::exp(I<>*theta);
137 res /= sqrt( (
double)
Sector.periodicity(idx)*
Sector.periodicity(idy) );
145 std::fill(matTot.begin(), matTot.end(), ComplexZero<>);
149 #pragma omp parallel for schedule(dynamic, 1) private(tempMatElem1, tempMatElem2)
150 for(
int idx = 0;idx < numParityEigens; ++idx) {
151 for(
int idy = idx;idy < numParityEigens; ++idy) {
153 matTot.at(idy,idx) = conj(matTot.at(idx,idy));
155 for(
int idy = numParityEigens;idy < dim; ++idy) {
158 matTot.at(idx,idy) = (tempMatElem1 + tempMatElem2)/sqrt(2.0);
159 matTot.at(idy,idx) = conj(matTot.at(idx,idy));
163 #pragma omp parallel for schedule(dynamic, 1) private(tempMatElem1, tempMatElem2)
164 for(
int idx = numParityEigens;idx < dim; ++idx) {
165 for(
int idy = idx;idy < dim; ++idy) {
168 matTot.at(idx,idy) = tempMatElem1 + tempMatElem2;
169 matTot.at(idy,idx) = conj(matTot.at(idx,idy));
173 #pragma omp parallel for schedule(dynamic, 1) private(tempMatElem1, tempMatElem2)
174 for(
int idx = 0;idx < dim; ++idx) matTot.at(idx,idx) = ComplexOne<>*real(matTot.at(idx,idx));
__global__ void MatrixElementsInSector(void)
Definition generateRM.cuh:61
__device__ Complex_t transEigenMatrixElements(Integer_t const idx, Integer_t const idy, Complex_t const *__restrict__ dmatLoc, Integer_t const LDL, Integer_t const n, Integer_t const dloc, Integer_t const momentum, Integer_t const *representatives, Integer_t const *periodicity, Real_t const *__restrict__ dfactor)
Definition generateRM.cuh:141
std::vector< std::vector< double > > prefactorOp
Definition generateRM.hpp:34
std::vector< std::vector< double > > prefactorH
Definition generateRM.hpp:33
std::vector< TransSector > Sector(n_max+1)
Definition mytypes.hpp:147
Translation invariant sector of a many-body Hilbert space.
Definition TransSector.hpp:19
debug_print("# Determining GPU configuration.")
GPUconfig GPUconf(dim3(nBlock, nBlock, 1), dim3(nThread, nThread, 1), 0, queue)
double Real_t
Definition mytypes.hpp:37
MKL_INT Integer_t
Definition mytypes.hpp:359
Integer_t const n_min
Definition setVariablesForEnsemble.cpp:28
Integer_t const n_max
Definition setVariablesForEnsemble.cpp:27