Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different tensor types should not compare equal #558

Closed
eschnett opened this issue Mar 6, 2021 · 2 comments · Fixed by #564
Closed

Different tensor types should not compare equal #558

eschnett opened this issue Mar 6, 2021 · 2 comments · Fixed by #564

Comments

@eschnett
Copy link
Contributor

eschnett commented Mar 6, 2021

I find this:

julia> VectorValue(1,2,3) == SymTensorValue(1,2,3)
true

This shouldn't be the case; 3d vectors are different from 2d tensors...

@eschnett
Copy link
Contributor Author

eschnett commented Mar 6, 2021

I think that

(==)(a::MultiValue,b::MultiValue) = a.data == b.data

should instead be

(==)(a::T,b::T) where {T <: MultiValue} = a.data == b.data

together with appropriate promotion rules. Alternatively, the comparison function could explicitly compare the tensor types (VectorValue, TensorValue, etc) of the arguments.

@fverdugo
Copy link
Member

Thanks for noting this @eschnett. You are right!
Can you open please a PR with the proposed changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants