Controlling global behaviors
TenNetLib.jl provides following functions to control global behaviors for Tensor Network simulations.
TenNetLib.Float64_threshold
— Functionfunction Float64_threshold()
function Float64_threshold(threshold::Float)
Returns threshold for floating point calculations. In most places, any number below this will be treated zero. E.g., in cutoff
. Default: 1e-15
.
Optionally, change the threshold as per the input threshold
.
TenNetLib.using_threaded_loop
— Functionfunction using_threaded_loop()
Returns the condition whether to use threaded loop in inbuild TeNLib functions.
TenNetLib.enable_threaded_loop
— Functionfunction enable_threaded_loop()
Enable the use of threaded loop in inbuild TeNLib functions.
TenNetLib.disable_threaded_loop
— Functionfunction disable_threaded_loop()
Disable the use of threaded loop in inbuild TeNLib functions.
TenNetLib.@threaded_loop
— Macromacro threaded_loop(code)
Conditional threaded loop by Threads.@threads
. If using_threaded_loop()
returns true, performs parallel loop, otherwise performs serial loop.
Note: All other forms of parallelization are switched off inside the loop body, if parallel loop is being executed.
Example:
@threaded_loop for i = 1 : N
# Do stuff in parallel
end