1#include <iostream>
2
3/* Includes State.h */
4#include "BasisU1.h"
5
6/* Maximal system size */
7#define MaxSites 128
8
9/* Hilbert space dimension */
10#define Q 2
11
12/* There is a hierarchy classes: */
13/* State class -> Container class -> Basis class -> Basis Iterator */
14
15/* Definition of the State class */
16using State=danceq::internal::State<MaxSites,Q,uint32_t>;
17
18/* Definition of the Container class */
19using Container=danceq::internal::ContainerTable<State>;
20
21/* Definition of the Basis class */
22using Basis=danceq::internal::BasisU1<Container>;
23
24/* Definition of the Basis Iterator */
25using BasisIterator=danceq::internal::BasisIterator<Basis>;
26
27int main(int argc, char *argv[]) {
28
29 /* Number of particles */
30 uint64_t n = 1;
31
32 /* System size */
33 uint64_t L = 4;
34
35 /* number of subsystems */
36 uint64_t Npart = 3;
37
38 /* Particle number, system size and number of subsystem can be edited at run time: ./main -n 5 -L 10 -Npart 4 */
39 if (argc > 1){
40 for(uint32_t i = 1; i < argc; ++i){
41 std::string arg_val(argv[i]);
42 bool input = true;
43 if(arg_val == "-n" and i < argc - 1){
44 n = static_cast<uint64_t>(std::stoi(argv[i+1]));
45 input = false;i++;
46 }
47 if(arg_val == "-L" and i < argc - 1){
48 L = static_cast<uint64_t>(std::stoi(argv[i+1]));
49 input = false;i++;
50 }
51 if(arg_val == "-Npart" and i < argc - 1){
52 Npart = static_cast<uint64_t>(std::stoi(argv[i+1]));
53 input = false;i++;
54 }
55 if(input){
56 std::cout << "[main] - Unknown option at input variable " << i << " : " << arg_val << std::endl;
57 }
58 }
59 }
60
61
62 std::cout << "[main] - L = " << L << std::endl;
63 std::cout << "[main] - n = " << n << std::endl;
64
65 /* State class */
66
67 /* Default constructor, all sites are set to zero */
68 State state;
69
70 /* Sets the last sites to 1 */
71 state.set_range(1, /*start=*/0, /*end=*/L);
72
73 /* Sets the last state to Q-1 */
74 state.set_state(0,L-1);
75
76 /* Output of the state */
77 std::cout << "[main] - state: " << state.get_string(/*start=*/0UL, /*end=*/L) << std::endl;
78
79 /* Output of the first site */
80 std::cout << "[main] - first site: " << state[0] << std::endl;
81
82 /* Output of the last site */
83 std::cout << "[main] - last site: " << state[L-1] << std::endl;
84
85
86 /* Basis class */
87
88 /* Construct the Basis of size L, with total particle number n, and Npart subsystems */
89 Basis basis(L,n,Npart);
90
91 /* Prints Basis information */
92 basis.info();
93
94 /* Simple iteration using the Basis iterator */
95 for(auto it=basis.begin(); it<basis.end(); ++it){
96
97 /* Retrieving the index from the iterator */
98 uint64_t current_index = it.get_index();
99
100 /* Output of the state; it-> points to the State class */
101 std::cout << "[main] - |Psi_" << current_index << "> = " << it->get_string(/*start=*/0UL, /*end=*/L) << std::endl;
102
103 }
104
105
106 return 0;
107}