NanoStructures  1.0
DMFT solver for layered, strongly correlated nanostructures
hilbertspacetable.h
Go to the documentation of this file.
1 #ifndef HILBERTSPACETABLE_H
2 #define HILBERTSPACETABLE_H
3 
12 /*
13  * Copyright (c) 2014 Christoph Schuette.
14  *
15  * The license and distribution terms for this file may be
16  * found in the file LICENSE in this distribution
17  */
18 
19 #include <assert.h>
20 #include <stdlib.h> /* abs */
21 
22 #define MAXITER 202
23 #define MAXQ 20
24 #define MAXSZ 20
25 
26 namespace nrg {
27  class HilbertSubSpace;
28 
32  public:
38 
47  inline HilbertSubSpace* getHS(int iteration, int Q, int Sz) {
48  if ((abs(Q) <= MAXQ) && (abs(Sz) <= MAXSZ) && (iteration < MAXITER) && (iteration >= -1))
49  return m_hilbertSpaces[ iteration + 1 + (Q + MAXQ)*(MAXITER + 1)+ (Sz + MAXSZ)*(MAXITER + 1)*(2 * MAXQ + 1) ];
50  else
51  return NULL;
52  }
53 
61  inline void setHS(int iteration, int Q, int Sz, HilbertSubSpace* HS) {
62  assert(abs(Q) <= MAXQ);
63  assert(abs(Sz) <= MAXSZ);
64  assert(iteration < MAXITER);
65  assert(iteration >= -1);
66  m_hilbertSpaces[ iteration + 1 + (Q + MAXQ)*(MAXITER + 1)+ (Sz + MAXSZ)*(MAXITER + 1)*(2 * MAXQ + 1) ] = HS;
67  }
68 
73 
74  protected:
75  HilbertSubSpace** m_hilbertSpaces;
76  };
77 }
78 
79 #endif // HILBERTSPACETABLE_H
HilbertSubSpace * getHS(int iteration, int Q, int Sz)
returns a pointer to the HilbertSubSpace for a given iteration, charge Q and spin Sz...
Definition: hilbertspacetable.h:47
HilbertSpaceTable()
constructs a table of HilbertSubSpace instances. The size of the table is determined by MAXITER...
Definition: hilbertspacetable.cpp:5
HilbertSubSpace: Hilbert subspace for charge quantum number Q and spin Sz. This class contains the ei...
Definition: hilbertsubspace.h:28
HilbertSpaceTable: Manages the table of HilbertSubSpace instances.
Definition: hilbertspacetable.h:31
void setHS(int iteration, int Q, int Sz, HilbertSubSpace *HS)
sets the HilbertSubSpace for a given iteration, charge Q and spin Sz.
Definition: hilbertspacetable.h:61
~HilbertSpaceTable()
destructs the HilbertSubSpace table and deletes all HilberSubSpace instances.
Definition: hilbertspacetable.cpp:12