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 cases, 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()
function using_threaded_loop(condition::Bool)Returns the condition whether to use threaded loop in inbuild TenNetLib.jl functions.
Optionally, change the condition as per the input condition.
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