Skip to content

Add right addition for sparse tensors: sptensor.__radd__ #458

@dmdunla

Description

@dmdunla

Add right addition to sptensor, as the following illustrates that this is not implemented:

>>> import pyttb as ttb
>>> import numpy as np
>>> S = ttb.sptenrand((2,2,2),0.3)
>>> S + 1
tensor of shape (2, 2, 2) with order F
data[:, :, 0] =
[[1.         1.        ]
 [1.32287731 1.        ]]
data[:, :, 1] =
[[1.         1.        ]
 [1.96931805 1.        ]]
>>> 1 + S
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'sptensor'
>>>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions