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

reverse of S/MBlade incorrect #11

Closed
Orbots opened this issue Feb 27, 2019 · 7 comments
Closed

reverse of S/MBlade incorrect #11

Orbots opened this issue Feb 27, 2019 · 7 comments
Labels

Comments

@Orbots
Copy link

Orbots commented Feb 27, 2019

works on a Multivector and Basis, but doesn't seem to give correct result for Blades.

julia> a
1.0v₁ + 2.0v₂ + 0.0v₃

julia> b
3.0v₁

julia> ab = a*b
3.0 - 6.0v₁₂

julia> reverse(ab)
3.0 + 6.0v₁₂

julia> reverse(ab(2))
6.0v₁ + 0.0v₂ + 0.0v₃

julia> typeof(ab(2))
SBlade{Float64,⟨+++⟩,2,3}
@chakravala chakravala added the bug label Feb 27, 2019
@chakravala
Copy link
Owner

chakravala commented Feb 27, 2019

@Orbots actually mistaken, this may not be a bug at all

I ran the same code that @MasonProtter ran on my branch, and I got the same exact output

julia> using Grassmann

julia> basis"+++"
(⟨+++⟩, v, v₁, v₂, v₃, v₁₂, v₁₃, v₂₃, v₁₂₃)

julia> a = 1.0v1 + 2.0v2 + 0.0v3
1.0v₁ + 2.0v₂ + 0.0v₃

julia> b = 3.0v1
3.0v₁

julia> ab = a*b
3.0 - 6.0v₁₂

julia> reverse(ab)
3.0 + 6.0v₁₂

julia> ab(2)
-6.0v₁₂ + 0.0v₁₃ + 0.0v₂₃

julia> reverse(ab(2))
6.0v₁ + 0.0v₂ + 0.0v₃

Can you start a clean session or go back in your history and check how you defined a and b?

@chakravala chakravala removed the bug label Feb 27, 2019
@MasonProtter
Copy link

@chakravala Yes, apologies I deleted my comment after realizing I misinterpreted the bug, ie. it's not fixed by removing @pure. I do think it is a bug though, correct? Reverse -6.0v12 should be 6.0v12, not 6.0v1

@MasonProtter
Copy link

Minimal working example:

julia> reverse(-6.0v12)
6.0v₁₂

julia> reverse(-6.0v12 + 0.0v13)
6.0v₁ + 0.0v₂ + 0.0v₃

@Orbots
Copy link
Author

Orbots commented Feb 27, 2019

Correct. This should pass: @test reverse(v12 + 0.0v13) == v2*v1 + 0.0v13 == -v12 0.0v13

Edit: corrected test.

@chakravala
Copy link
Owner

chakravala commented Feb 27, 2019

This is now fixed in the commit I just pushed, the grade should have been G instead of N-G.

I will add the test on a future commit or you can make a pull request with more tests

@Orbots
Copy link
Author

Orbots commented Feb 27, 2019

Thanks for the quick response!

@chakravala
Copy link
Owner

That bug would have taken me longer to find on my own!

By the way, I just had to force push the commit once more, now I understand where mistake came from, it was because I had re-used a similar code from the complement, but didn't change the grade.

@chakravala chakravala added the bug label Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants