-
Notifications
You must be signed in to change notification settings - Fork 58
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
Do we have addmul! for MatrixSpace #1177
Comments
If your matrices are square you can use MatrixAlgebras instead of MatrixSpaces and then in theory there should be something like addmul (I didn't check if it is actually there). But having said that, there really isn't much it can do. The main cost is in multiplying the matrices, not in allocating the result, I would have thought. |
Unfortunately, most of our matrices are not square. We were just wondering if there could be any improvement on the performance of matrix multiplication, since we found the matrix multiplication is the heaviest burden in our code. |
I don't think we can save much. You can't actually mutate the entries in a matrix, according to our aliasing rules, so the only saving would be the allocation of the actual matrix itself, which is probably a trivial cost in comparison to the cost of the arithmetic. Are your matrices 3x3 or larger? It should be easy enough for you to wrap the Arb matrix mul function to see if it makes any difference to you. But I doubt it. The larger the matrices, the more negligible the improvement would be. |
The matrix could be much larger than this demo code. What do you mean by the " |
I mean that you could add your own addmul! function to Nemo, making use of the acb_mat_mul and acb_mat_add functions (or addmul if it exists). If it turns out to be a big win for you, we could consider adding it to Nemo officially. |
Thank you! We will definitely share it if it indeed works. |
In our code, there are lots of operations like
mat1 += mat2*mat3
for the objects MatrixSpace.For example
But the error message told us there is no definition of addmul! for MatrixSpace.
Do we have any other approach for this? Or the code
mat1 += mat2*mat3
has been the best for now?Thank you!
The text was updated successfully, but these errors were encountered: