Closed Alphaharrius closed 8 months ago
Applied fix following suggestion 1, all test cases passed.
The current full renormalization process for 192x192
Chern insulator requires 7.98GiB
of RAM for the Julia environment on MacBook Pro M3 Max 14-core model; after applying @memoize
on Mode
it becomes 7.85GiB
.
Although the fix has been applied, yet adding @memoize
to the constructors of Point
and Mode
in hopes of reducing memory usage failed, so those changes have been reverted.
Current definition of
(==)(::Offset, ::Offset)
is defined as comparing only theirrpos
, which the implementation ofrpos
ofOffset
is first transforming it into Euclidean (identity) basis then performs the rationalization. This method allowsOffset
in differentRealSpace
basis with the same location information in Euclidean basis to hash to same value and equates, which makes location comparison easier and less technical.Yet if we would like to include
@memoize
forOffset
andMode
generation which attempt to reduce memory strain during runtime, it would introduce issues since it will make someOffset
orMode
degenerates when reusing the memoized result.Suggested fix (Either one)
(==)(::Offset, ::Offset)
such that it also checks the equality of the underlyingRealSpace
basis, this will allowsDict
to store distinctOffset
andMode
even if they are informationally the same.hash(::Offset)
such that it also includes the hash of the underlyingRealSpace
basis, the benefits is the same as 1 but also preserves the convenience of==
over differentRealSpace
basis, yet this will break the rule ofhash
which hash objects to the same value if they equals.