-
Notifications
You must be signed in to change notification settings - Fork 323
m.t() * m #445
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
Comments
This signature is probably the signature of the pure rust implementation of matrix multiplication. |
Going off @vbarrielle 's earlier comment if you want to use a
So, if you'd want to try out the |
@vbarrielle and @rcarson3, thank you for your answers. I'll test what you suggest and contribute if the results are interesting. Maybe having a |
I think it would be useful to incorporate the On second thought, maybe it would make more sense to create a separate crate for providing |
I think the separate crate idea makes a lot of sense. I'm sure there are a lot of BLAS calls that aren't in Edit: I'd also like to mention that I'd be up for helping work on this new crate. However, my current work load will probably limit my ability to contribute to it as much as I'd like for the next few months. |
I tested and the BLAS results are interesting! I made 4 simple benchmarks with 100x50 identity matrices. Results are in ns. As you can see, the speedup is around 2.8x .
I also tested a normal Rust implementation but it's a disaster! I wasn't aware that I'm not finished with this task because I don't know if you want a new crate and I'm unsure how to manage the A'A or AA' option (enum or different method?) I can probably push what I did even if we don't have a concensus yet, if there's any interest? |
It looks great :) FYI, A'A can be called as a square of "absolute value of matrix" |A|^2 |
@termoshtt Yes, maybe this stuff should be in your crate. Or not. It's not for me to decide! The owner(s) of this crate should state their opinion. Also, I know this is not the right place for a math course but can you please explain more? As a programmer, "absolute value of matrix" means calling |
I'd prefer to place less-commonly-used BLAS wrappers such as this function in a crate outside of |
Closing this issue. As explained, such a feature would be in another crate of the ndarray ecosystem. |
@nilgoyette, I'm running into the same issue where I am doing a lot of |
Sorry @benkay86, I changed computed 2 times at work in the last 6 years and this particular folder has been lost. IIRC, it wasn't terribly complex to code. I think I simply copied the "dot" code that calls |
Is there an optimization available for a matrix multiplication with its transpose? I'm trying to optimize a program where the slowest part is
m.t() * m
(a somewhat big matrix in the most inner loop). I read more about this and it always give a symmetrical matrix, which would make the operationn(n+1)/2
instead ofn^2
. The lapack functiondsyrk
is supposed to handle that. I don't know if it would actually help but I'm curious to test.Also, is there a way to know if I'm using lapack? I didn't give any special feature to ndarray in my cargo.toml file. A
perf
told me29.26% _ZN14matrixmultiply4gemm13masked_kernel
so I think I'm using it becausegemm
is a lapack name. But is there a simpler way?EDIT: Oh, sorry, I meant
BLAS
everywhere in my text. I wasn't aware of the difference :)The text was updated successfully, but these errors were encountered: