qlat_utils¶
Qlattice utility package
Usage:
import qlat_utils as q
Will also be loaded by import qlat as q together with other qlat functions.
Message¶
Return the current verbosity level as integer. |
|
|
Set the current verbosity level as integer. |
|
Print all the arguments and then print a newline. |
|
Same as |
Return the function name of the current function |
Timer¶
|
Timing functions. |
|
Timing functions. |
|
Timing functions with flops. |
|
Timing functions with flops. |
|
|
|
|
|
Return current time in seconds since epoch. |
Return start time in seconds since epoch. |
Random number¶
|
|
|
Return a signature (a floating point number, real or complex) of data viewed as a 1-D array of numbers. |
Algorithm of the random number generator¶
The state of the generator is effectively composed of the history of the generator encoded as a string.
To generate random numbers, one computes the SHA-256 hash of the string. The hash result is viewed as a 8 32-bit unsigned integers.
The 8 32-bit unsigned integers are merged into 4 64-bit unsigned integers. These 4 numbers are treated as the random numbers generated by this random number generator.
Relevant source files: qlat-utils/include/qlat-utils/rng-state.h and qlat-utils/lib/rng-state.cpp
Coordinate¶
|
Return |
|
Return |
|
Return |
|
Return |
Return a list composed of the 4 components of the coordinate. |
|
Return a tuple composed of the 4 components of the coordinate. |
|
Return a np.ndarray composed of the 4 components of the coordinate. |
|
set value based on a list composed of the 4 components of the coordinate. |
|
Return the square sum of all the components as |
|
get spatial distance square as int |
|
get product of all components |
|
get product of all components |
|
|
|
|
|
Return a list composed of the 4 components of the coordinate. |
|
Return a tuple composed of the 4 components of the coordinate. |
|
Return a np.ndarray composed of the 4 components of the coordinate. |
|
set value based on a list composed of the 4 components of the coordinate. |
Cache system¶
|
self.cache_keys |
|
make cache if it does not exist, otherwise return existing elements |
|
Remove values of cache, but keep all the structures |
|
|
|
remove cache if it exist |
Example code:
Usage:
cache_x = q.mk_cache("xx")
q.clean_cache(cache_x)
cache_x[key] = value
val = cache_x[key]
key in cache_x
val = cache_x.get(key)
val = cache_x.pop(key, None)
Matrix for QCD¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ElemType¶
Data analysis¶
|
Split |
|
|
|
qnorm(2) == 4 |
Spatial distance list¶
|
|
|
Make a list of r values from 0 up to r_limit. |
|
Returns (x_idx_low, x_idx_high, coef_low, coef_high,) |
|
Return a list of tuples: |
Interpolation¶
|
return |
|
return approximately |
|
return |
|
return |
|
return |
|
return x_arr |
Plotting¶
|
fn is full name of the plot or None dts is dict_datatable, e.g. { "table.txt" : [ [ 0, 1, ], [ 1, 2, ], ], } cmds is plot_cmds, e.g. [ "set key rm", "set size 1.0, 1.0 ", ] lines is plot_lines, e.g. [ "plot", "x", ]. |
|
Example code to make a plot: examples-py/qplot.py