-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
inconsistent behaviour of * and \ for non-square matrices: #85
Comments
This is interesting. I think this problems stems from a difference between a 10-element array and a 10x1 array. After a short testing session, it seems if you use mat*vec'' (which casts vec as a 10x1 array instead of a 10-element array), you get a dimension mismatch error. I'm fairly new to Julia, but what exactly is the different between a 10-element and a 10x1 array? Conceptually nothing, but what files should I/we be investigating for this? |
I missed this issue, but I have submitted a fix in #85. @JohnnyAppleDev The easiest way to find the relevant place in the source is to put the macro |
Fixed by #85 |
@andreasnoackjensen Thanks for the tip and the fix. |
Thanks indeed |
I did not want to add this issue to the Number/Matrix issue, as it is of a different nature and might get lost in the long discussion going on over there.
Consider the following:
vec=rand(10)
mat=reshape(vec,(10,1))
None of this should work: vec * vec, mat_mat, vec_mat mat_vec
(at least not from an algebraic point of view, I am not so familiar with the broadcasting rules but in relation to the other discussion I would favour to explicitly require the use of ._ for broadcasting)
The first (vector vector multiplication) gives a no method error
The second (matrix matrix multiplication) gives a dimension mismatch error
The third (vector matrix multiplication) gives a dimension mismatch
The fourth, however, computes something. It took me a second before realising what was computed exactly, but it seems to be mat * vec[1]. I don't think this falls under the scope of broadcasting.
Even knowing that A\B is generalised to non-square matrices A if B has the same number of columns as A (in the least square sense), the following should still not exist: vec' \ vec and vec \ vec'
Yet, vec' \ vec = vec' \ mat produces a vector of length 10
(I do not immediately see what is calculated)
vec \ vec' = mat \ vec' produces:
** On entry to DORMQR parameter number 10 had an illegal value
ERROR: ArgumentError("invalid argument JuliaLang/julia#10 to LAPACK call")
The text was updated successfully, but these errors were encountered: