Skip to content

Equality testing for matrices assumes that entities tested are, in fact, matrices #283

@fredrik-johansson

Description

@fredrik-johansson
What steps will reproduce the problem? import mpmath as MP
BigMat=None # initialize a symbol that might or might not be used

# Work that may or may not create BigMat depending on circumstances
# but which, in a particular instance, does happen to execute...
BigMat=MP.matrix([1,2,3])
# ... and then later, to see if the program took that path one tries..

if BigMat==None:
   blah..
else:
   blah blah... 

What is the expected output? 
The expected result would be a False or True branch in the "if" statement
depending on whether BigMat had or had not been created by the particular workflow.

What do you see instead?
    669     def __eq__(self, other):
--> 670         return self.__rows == other.__rows and self.__cols == other.__cols \
    671                and self.__data == other.__data
    672 

AttributeError: 'NoneType' object has no attribute '_matrix__rows' What version of the product are you using? On what operating system? 0.17 on Windows 7 (64-bit) Please provide any additional information below. Entities can fail to be equal for lots of reasons; a solution would be to preface tests with guard statements generating appropriate returns when apples and oranges are compared.

Original issue for #283: http://code.google.com/p/mpmath/issues/detail?id=243
Original author: https://code.google.com/u/115096564883933431558/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions