Skip to content

sptensor: output of comparison operators should have bool values #285

@dmdunla

Description

@dmdunla

Although #269 fixed the output for logical_* methods, the comparison operators in sptensor currently output float values and not bool values.

For consistency with other tensor classes and the logical_* methods, this should change to outputting bool values.

>>> import pyttb as ttb
>>> import numpy as np
>>> S = ttb.sptensor(shape=(2,2))
>>> S[1,1] = 1.0
>>> S > 0
sparse tensor of shape (2, 2) with 1 nonzeros
[1, 1] = 1.0
>>> S >= 0
sparse tensor of shape (2, 2) with 4 nonzeros
[1, 1] = 1.0
[0, 0] = 1.0
[0, 1] = 1.0
[1, 0] = 1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions