upiterbarg / mpmath

Automatically exported from code.google.com/p/mpmath
Other
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 reported on code.google.com by welc...@ksu.edu on 11 Sep 2013 at 1:55