odlgroup / odl

Operator Discretization Library https://odlgroup.github.io/odl/
Mozilla Public License 2.0
374 stars 105 forks source link

Product-space operators cannot be accessed by index anymore #1650

Closed leftaroundabout closed 2 months ago

leftaroundabout commented 3 months ago

ProductSpaceOperator works fine when applied to vectors or othewise evaluated, but when treated as a matrix of operators the index-accessor operator gives incorrect results:

odl/odl/discr/discr_utils.py:286: DocTestFailure
______________________________ [doctest] odl.operator.pspace_ops.ProductSpaceOperator.__getitem__ _______________________________
466         --------
467         >>> r3 = odl.rn(3)
468         >>> pspace = odl.ProductSpace(r3, r3)
469         >>> I = odl.IdentityOperator(r3)
470         >>> prod_op = ProductSpaceOperator([[0, I],
471         ...                                 [0, 0]],
472         ...                                domain=pspace, range=pspace)
473         >>> prod_op[0, 0]
474         0
475         >>> prod_op[0, 1]
Expected:
    IdentityOperator(rn(3))
Got:
    0

This is likely related to the recent change in implementation to a custom sparse matrix (https://github.com/odlgroup/odl/pull/1642).

leftaroundabout commented 2 months ago

Fixed by #1651.