-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
generic lufact requires more than it should #431
Comments
Could you please submit a Pull Request with these changes so that people can easily test them out? |
OK. I am new to this (never contributed to any open source project). I put an example derived from the ModInt example in the Julia source here: The second issue is how to control pivoting in lufact. It seems to me that there could be three options here:
The current implementation uses Val{false} and Val{true} to choose between 1. and 3. Adding 2. would require a bigger discussion. |
It would be great with the other pivoting option as well. The reason for the current design is that we try to use the same API for LU and QR. The pivoted QR returns a different type which is the reason why we use |
I had wondered why the I'm not sure how to proceed. I'm new to contributing to Julia, so it was exciting(!) to see my PR make progress - but I haven't actually solved my original problem. My motivation is that I'm learning about finite fields and abstract algebra to enable understanding and implementation of error control coding - similar to https://github.com/andrewcooke/IntModN.jl |
I've made a minimal Mod{N} with only the operations required to be a field.
I needed to make a few modifications to the linalg code to get A \ b to work for a square matrix A with Mod{N} as the element type.
Specifically:
In a few places, a literal "0" is used instead of zero( .. ). I'd rather not add a conversion / promotion. It should work without this.
In one place "real( .. )" is used to initialize a variable that will hold the result of abs( .. )
If I turn off pivoting to reduce the requirements on my type further (so I don't need < or abs) then it doesn't work due to a SingularException error. I added a search for the first non-zero index and pivot on that - so its now pivoting, but without the requirement to have "abs" and "<".
I use this to line to turn off pivoting for matrices of my type Mod{N}:
import Base: lufact lufact{N}(A::AbstractMatrix{Mod{N}}, pivot::Union{Type{Val{false}}, Type{Val{true}}} = Val{false}) = lufact!(copy(A), pivot)
Below is a complete diff of my changes relative to v0.6.0-rc2.
Its pretty amazing that you can do this in Julia. It'd be great if we could fix these minor issues.
I'm not a mathematician, so I'm not completely sure about the pivoting on non-zero element, but it worked for me on my one(!) test case.
The text was updated successfully, but these errors were encountered: