This repository was archived by the owner on Jan 30, 2023. It is now read-only.
File tree 1 file changed +17
-13
lines changed
1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -2845,23 +2845,27 @@ def _on_basis(self, m):
2845
2845
cc = self ._cos_coeff
2846
2846
keys = cc .keys ()
2847
2847
2848
- s = E . base_ring () .zero ()
2848
+ tot = E .zero ()
2849
2849
2850
- sgn = 0
2850
+ for sgn , i in enumerate (m ):
2851
+ k = FrozenBitset ((i ,))
2852
+ if k in keys :
2853
+ below = tuple (j for j in m if j < i )
2854
+ above = tuple (j for j in m if j > i )
2851
2855
2852
- for i in m :
2853
- if FrozenBitset ((i ,)) in keys :
2854
- key_basis , key_coeff = cc [FrozenBitset ((i ,))].list ()[0 ]
2855
- m_temp = Bitset (m )
2856
- if key_basis .intersection (m_temp ):
2857
- continue
2858
- m_temp .discard (i )
2859
- m_temp .update (key_basis )
2856
+ # a hack to deal with empty bitsets
2857
+ if len (below ) == 0 :
2858
+ below = FrozenBitset ('0' )
2859
+ else :
2860
+ below = FrozenBitset (below )
2861
+ if len (above ) == 0 :
2862
+ above = FrozenBitset ('0' )
2863
+ else :
2864
+ above = FrozenBitset (above )
2860
2865
2861
- s = s + (- 1 )** ( sgn % 2 ) * key_coeff * E .monomial (FrozenBitset ( m_temp ) )
2866
+ tot = tot + (- 1 )** sgn * E . monomial ( below ) * cc [ k ] * E .monomial (above )
2862
2867
2863
- sgn += 1
2864
- return s
2868
+ return tot
2865
2869
2866
2870
@cached_method
2867
2871
def chain_complex (self , R = None ):
You can’t perform that action at this time.
0 commit comments