full name: tenpy.tools.optimization.temporary_level
- class tenpy.tools.optimization.temporary_level(temporary_level)¶
Context manager to temporarily set the optimization level to a different value.
Optimization level to be restored at the end of the context manager.
It is recommended to use this context manager in a
# optimization level default with temporary_level(OptimizationFlag.safe): do_some_stuff() # temporarily have Optimization level `safe` # you can even change the optimization level to something else: set_level(OptimizationFlag.skip_args_check) do_some_really_heavy_stuff() # here we are back to the optimization level as before the ``with ...`` statement