-
Notifications
You must be signed in to change notification settings - Fork 134
implement :det_exact and :inverse_exact for list/yale matrices #334
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
Conversation
|
@cjfuller What do you think, particularly given the discussion in #189? Is it worth it to automatically cast small list and yale matrices to dense in order to calculate the determinant, or is it that we really need these functionalities separately for Yale matrices? I'm leaning towards saying we really need the functionality for Yale matrices. When I opened the issue initially, I envisioned that it would not be cast. I feel like the user won't expect an automatic cast to be happening, so it's not the best design choice. |
|
Actually, I have almost finished a separate implementation for Yale matrices... It may be released next week, because I have to go outside and get little time to work in this weekend. |
|
@spacewander That's excellent! I look forward to seeing the patch. =) Let's discuss more at that point. |
|
Sorry, late to the party here, but: I agree that the casting may be a bit surprising. I'd expect I wholeheartedly support @spacewander's appraoch of benchmarking it so that we can talk in more concrete terms! |
|
Here is the benchmark: The casting implementation can be checkout from there: Casting VS. Separate Yale implementation: require 'benchmark'
require_relative 'lib/nmatrix'
m = NMatrix.new(2, [1,2,3,4], stype: :yale, dtype: :int64)
Benchmark.bm do |x|
x.report {50000.times do ; m.det_exact; end}
endn = m.clone
Benchmark.bm do |x|
x.report {50000.times do; n = m.clone; m.method(:__inverse_exact__).call(n, 2,2); end}
end |
|
Cast list matrix to yale matrix VS. cast list matrix to dense matrix: det_exact: Almost the same. inverse_exact Cast to yale is faster than cast to dense. |
|
I'm happy to see my code for casting list to yale is working so well. =) @spacewander Can you give me a link to the Yale exact determinant code you wrote? |
|
My code can be reviewed from there Simply, it is a Yale specific version of |
|
Could you submit that code as a pull request, along with a spec, and tag it with this issue? I want to make sure the code actually does what we think it does. Yale can be tricky. |
|
Overcome by #582, I think. |
Hope this can fix #189