Controlling global behaviors

TenNetLib.jl provides following functions to control global behaviors for Tensor Network simulations.

TenNetLib.Float64_thresholdFunction
function 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.

source
TenNetLib.@threaded_loopMacro
macro 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
source