OptimizationFlag
full name: tenpy.tools.optimization.OptimizationFlag
parent module:
tenpy.tools.optimization
type: class
Inheritance Diagram
Methods
Returns self, the complex conjugate of any int. |
|
Number of bits necessary to represent self in binary. |
|
Number of ones in the binary representation of the absolute value of self. |
|
|
Like |
|
Like |
Return integer ratio. |
|
|
Class Attributes and Properties
the real part of a complex number |
|
the imaginary part of a complex number |
|
the numerator of a rational number in lowest terms |
|
the denominator of a rational number in lowest terms |
|
|
|
|
|
|
|
|
- class tenpy.tools.optimization.OptimizationFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
IntEnum
Options for the global ‘optimization level’ used for dynamical optimizations.
Whether we optimize dynamically is decided by comparison of the global “optimization level” with one of the following flags. A higher level includes all the previous optimizations.
Level
Flag
Description
0
none
Don’t do any optimizations, i.e., run many sanity checks. Used for testing.
1
default
Skip really unnecessary sanity checks, but also don’t try any optional optimizations if they might give an overhead.
2
safe
Activate safe optimizations in algorithms, even if they might give a small overhead. Example: Try to compress the MPO representing the hamiltonian.
3
skip_arg_checks
Unsafe! Skip (some) class sanity tests and (function) argument checks.
Warning
When unsafe optimizations are enabled, errors will not be detected that easily, debugging is much harder, and you might even get segmentation faults in the compiled parts. Use this kind of optimization only for code which you successfully ran before with (very) similar parameters and disabled optimizations! Enable this optimization only during the parts of the code where it is really necessary. Check whether it actually helps - if it doesn’t, keep the optimization disabled!
- classmethod from_bytes(bytes, byteorder, *, signed=False)[source]
Like
int.from_bytes
, which has a docstring which sphinx cant parse
- to_bytes(length=1, byteorder='big', *, signed=False)[source]
Like
int.to_bytes
, which has a docstring which sphinx cant parse
- conjugate()
Returns self, the complex conjugate of any int.
- bit_length()
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- bit_count()
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- as_integer_ratio()
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- real
the real part of a complex number
- imag
the imaginary part of a complex number
- numerator
the numerator of a rational number in lowest terms
- denominator
the denominator of a rational number in lowest terms