====== NBitsKey ====== ### unsigned integer, read and write ### ### Integer representing the size of the Hash key (//size// = 2//NBitsKey//). Wavefunctions are stored in a sparse format. In order to quickly find determinants within the function we use has functions and lookup tables. The size of the lookup table is currently static. This will change in future versions, but for the moment one needs to control this size manually. The larger the key the more memory is needed. If the key is smaller than the total number of determinants present in the wavefunction the program will slow down. For optimal performance the keylist should be larger than the total number of determinants present. ### ===== Example ===== ### We can define the function: $$ |\psi\rangle = \left(\frac{1}{\sqrt{4}} a^{\dagger}_0 a^{\dagger}_1 + \frac{1}{\sqrt{4}} a^{\dagger}_0 a^{\dagger}_2 + (1+I)\frac{1}{\sqrt{4}} a^{\dagger}_1 a^{\dagger}_2 \right)|0\rangle. $$ In order to get some information on the internal representation of this function we can use the Print method including the option //{"Full",true}//. This prints, besides information on the wavefunction also information on pointer addresses and hash tables. ### ### If we reduce the hash table from 216 to 21 we find that there are some collisions between the determinants. For determinants with collisions we automatically create a linked list such that the right determinant is always found. The value of //NBitsKey// thus only refers to performance, never to the final answer. ### ==== Input ==== NF=3 NB=0 psi = NewWavefunction(NF, NB, {{"110",sqrt(1/4)},{"101",sqrt(1/4)},{"011",(1+I)*sqrt(1/4)}}) psi.Print({{"Full",true}}) psi.NBitsKey=1 psi.Print({{"Full",true}}) ==== Result ==== Full printout of WaveFunction: Wave Function Genneral settings QComplex = 1 (Real==0 or Complex==1) N = 3 (Number of basis functions used to discribe psi) NBlok = 1 (Number of bloks needed to store psi) NFermion = 3 (Number of fermions in the one particle basis) NBoson = 0 (Number of bosons in the one particle basis) NWord = 1 (NFermion/8)+NBoson NBitsKey = 16 (Size of the key used for the hash table lookup) Pointer positions (addresses) **ValueRe = 0x101c53ff0 **ValueIm = 0x101c55ff0 **Next = 0x101c57ff0 **Determinant = 0x101c59ff0 BlokNr. = 0 *ValueRe = 0x101c5c000 *ValueIm = 0x101c7e000 *Next = 0x101ca0000 *Determinant = 0x101cb2000 Non-zero elements of Hash Table i= 13917 , key= 2 i= 29407 , key= 3 i= 48988 , key= 1 pre-factor +I pre-factor Pointer Addres Next_Hash Hash_Value Determinant 5.000000000000E-01 0.000000000000E+00 0x101c5c008 0 48988 C0 5.000000000000E-01 0.000000000000E+00 0x101c5c010 0 13917 A0 5.000000000000E-01 5.000000000000E-01 0x101c5c018 0 29407 60 Full printout of WaveFunction: Wave Function Genneral settings QComplex = 1 (Real==0 or Complex==1) N = 3 (Number of basis functions used to discribe psi) NBlok = 1 (Number of bloks needed to store psi) NFermion = 3 (Number of fermions in the one particle basis) NBoson = 0 (Number of bosons in the one particle basis) NWord = 1 (NFermion/8)+NBoson NBitsKey = 1 (Size of the key used for the hash table lookup) Pointer positions (addresses) **ValueRe = 0x101ccbff0 **ValueIm = 0x101ccdff0 **Next = 0x101ccfff0 **Determinant = 0x101cd1ff0 BlokNr. = 0 *ValueRe = 0x101c5c000 *ValueIm = 0x101c7e000 *Next = 0x101ca0000 *Determinant = 0x101cb2000 Non-zero elements of Hash Table i= 0 , key= 1 i= 1 , key= 2 pre-factor +I pre-factor Pointer Addres Next_Hash Hash_Value Determinant 5.000000000000E-01 0.000000000000E+00 0x101c5c008 0 0 C0 5.000000000000E-01 0.000000000000E+00 0x101c5c010 3 1 A0 5.000000000000E-01 5.000000000000E-01 0x101c5c018 0 1 60 ===== Available properties ===== {{indexmenu>.#1}}