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
It appears that the built-in methods to compute the characteristic polynomial of a poset recompute Moebius function values redundantly, leading to slowdown. For example:
sage: P = characteristic_polynomial(posets.SetPartitions(7))
sage: %time S.characteristic_polynomial()
CPU times: user 27.2 ms, sys: 14.4 ms, total: 41.6 ms
Wall time: 69.4 ms
q^4 - 10*q^3 + 35*q^2 - 50*q + 24
but by memoizing:
sage: %time characteristic_polynomial(S)
CPU times: user 4.8 ms, sys: 212 µs, total: 5.01 ms
Wall time: 5.09 ms
t^4 - 10*t^3 + 35*t^2 - 50*t + 24