Skip to content

Conversation

@isuruf
Copy link
Contributor

@isuruf isuruf commented Sep 11, 2023

No description provided.

:return: self <= other
"""
if isinstance(other, int):
return self.le_set(self * 0 + other)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There must be a better way to do this.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    zero = Aff.zero_on_domain(LocalSpace.from_space(space))
    result[0] = PwAff.from_aff(zero)

Comment on lines +734 to +737
PwAff.__le__ = pw_le
PwAff.__lt__ = pw_lt
PwAff.__ge__ = pw_ge
PwAff.__gt__ = pw_gt
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue with this is that it can't extend to == and !=. I wonder whether that invalidates the idea...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. This is a problem for eg: SymPy where == and != are structural equivalence and Eq gives an expression. Numpy however is consistent and implements == and != and returns a numpy array of bools.

PwAff.__lt__ = pw_lt
PwAff.__ge__ = pw_ge
PwAff.__gt__ = pw_gt
PwAff.__bool__ = pw_bool
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to override __bool__ on Set.

:return: self <= other
"""
if isinstance(other, int):
return self.le_set(self * 0 + other)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    zero = Aff.zero_on_domain(LocalSpace.from_space(space))
    result[0] = PwAff.from_aff(zero)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants