You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Schur slicer has uninitialized fields that get only computed at call time. Thus, their eventual value depends on the parent hamiltonian at call time, not creation time. This can produce bugs if the unexported gs = Quantica.call!(g, ω; params...) is used and then parent(g) is called before slicing gs for the first time. This makes call! unsafe, strictly speaking. The reason for the design is performance: we don't initialize any slicer fields that may not be used at all. The exported g(ω; params...) syntax decouples the slicer's parent Hamiltonian, so it is safe.
It is not clear if this issue should be fixed. As long as Quantica.call! is used with care (it is equivalent to unsafe methods in Base, and it is not exported for that reason). However, the issue is not unavoidable, as it relies on the uninitialized behavior of SchurGreenSlicer, which is a risky pattern to use. Better alternatives could be sought without sacrificing performance.
The text was updated successfully, but these errors were encountered:
The Schur slicer has uninitialized fields that get only computed at call time. Thus, their eventual value depends on the parent hamiltonian at call time, not creation time. This can produce bugs if the unexported
gs = Quantica.call!(g, ω; params...)
is used and thenparent(g)
is called before slicinggs
for the first time. This makescall!
unsafe, strictly speaking. The reason for the design is performance: we don't initialize any slicer fields that may not be used at all. The exportedg(ω; params...)
syntax decouples the slicer's parent Hamiltonian, so it is safe.MWE
It is not clear if this issue should be fixed. As long as
Quantica.call!
is used with care (it is equivalent tounsafe
methods in Base, and it is not exported for that reason). However, the issue is not unavoidable, as it relies on the uninitialized behavior ofSchurGreenSlicer
, which is a risky pattern to use. Better alternatives could be sought without sacrificing performance.The text was updated successfully, but these errors were encountered: