sandialabs / pyttb

Python Tensor Toolbox
https://pyttb.readthedocs.io
BSD 2-Clause "Simplified" License
25 stars 13 forks source link

Sptensor compare #331

Closed ntjohnson1 closed 1 week ago

ntjohnson1 commented 1 week ago

Should resolve https://github.com/sandialabs/pyttb/issues/287

I added tests that should cover the enumerated cases. I also cleaned up the inconsistency Jeremy found. Previously our eq/ne were inconsistent with lt,le,gt,ge where the first yielded boolean tensors and the later yielded float tensors with 1.0/0.0 for the boolean context. I think tensor and sptensor still are mismatched on this with tensor returning booleans. There is already a ticket for thinking about this.

I pulled the gt/lt/le/ge code into a common method but it's a little messier than it could be but I think incremental progress is beneficial.

I branched off of https://github.com/sandialabs/pyttb/pull/330 since I had that locally. If that proves controversial I assume I can rebase to main without too much headache.


📚 Documentation preview 📚: https://pyttb--331.org.readthedocs.build/en/331/