-
Notifications
You must be signed in to change notification settings - Fork 5
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
exact pfaffian bug #49
Comments
In particular, it works for most 8x8 matrices, but occasionally it will fail: julia> for i = 1:20
A = skewhermitian(big.(rand(-10:10,8,8)*2))
@show pfaffian(A)^2 == det(A)
end
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = false
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true
pfaffian(A) ^ 2 == det(A) = true So it must be in one of the rare branches of the code. |
Okay, it looks like there is a bug in the swapping code here: https://github.com/smataigne/SkewLinearAlgebra.jl/blob/8bb7028e4c460af4733c591a39adab02be85a36f/src/pfaffian.jl#L27-L34 The failure only occurs in the (relatively) rare cases where row/column swaps are needed. |
Yeah, it seems that I can't swap rows and columns in the same loop without some additional logic. Easier just to swap in separate loops, since this step is O(n) and hence negligible anyway. |
Here is an example of an 8x8 matrix for which our (my) "exact" Pfaffian routine is apparently giving the wrong answer:
The text was updated successfully, but these errors were encountered: