wbhart / AbstractAlgebra.jl

Generic abstract algebra functionality in pure Julia (no C dependencies)
Other
55 stars 6 forks source link

Do not throw an error when comparing two objects with different parents #9

Closed thofma closed 5 years ago

thofma commented 5 years ago

This fixes the following bug:

julia> a = zero_matrix(ZZ, 2, 3)
[0 0 0]
[0 0 0]

julia> b = zero_matrix(ZZ, 3, 3)
[0 0 0]
[0 0 0]
[0 0 0]

julia> a in [b, a]
ERROR: Incompatible matrix spaces in matrix operation
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] check_parent at /home/thofmann/.julia/dev/AbstractAlgebra/src/generic/Matrix.jl:108 [inlined]
 [3] ==(::AbstractAlgebra.Generic.Mat{BigInt}, ::AbstractAlgebra.Generic.Mat{BigInt}) at /home/thofmann/.julia/dev/AbstractAlgebra/src/generic/Matrix.jl:680
 [4] in(::AbstractAlgebra.Generic.Mat{BigInt}, ::Array{AbstractAlgebra.Generic.Mat{BigInt},1}) at ./operators.jl:950
 [5] top-level scope at none:0

julia> a in [a, b]
true