-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
ones(3) != ones(3)'' #2686
Comments
Which is the change? |
I think I would forbid transposition on vectors, transposition is fundamentally a matrix operation, so it would be a conceptual mistake for the user to try to apply it one a one-dimensional object in the first place. |
If people think a "1 x N" matrix |
If you forbid transpose of ones() vectors then you lose some nice, elegant solutions. Here is one that solves the global min variance portfolio port = (invsig * onevec) / (onevec' * invsig * onevec) ( |
We're not going to forbid transposing vectors. We try to make vectors and column matrices as behaviorally similar as possible. This is just a matter of making |
I'm not sure about that one. Vectors and column matrices will behave differently often enough that I think that it would be pretty misleading. I would much rather like if double transposition could be made an actual noop. |
A very similar problem: a = ones(3,3) julia> a[:,1] == a[1,:]' false In this case the only options I see are to change the behavior of '==' or to make a[:,1] produce or 3x1 matrix instead of a vector. |
The more I think, the more I support the suggestion of Staross. |
Please indicate how a literal will indicate one way or another, and explain why we should annoy people for whom there is no distinction (which is to say, everyone in my office, and a great many other MATLAB users.) |
While I don't think disallowing taking the transpose of a vector is reasonable, I also think that ignoring trailing singleton dimensions when checking |
@pao @StefanKarpinski |
Fortran certainly isn't the only language which draws that distinction. But I don't think that slices with exactly one non-singleton dimension losing their shape (by becoming distinct vectors) is a good plan, either. That can cause less of generality when inputs happen to have a particular number of dimensions. But if they don't become vectors, certain versions of this problem still exist as highlighted above. |
I actually like it the way it is and find |
You like that |
I don't really think of them as being the same. I'm an engineer, not a Obviously, I can adapt to something else if this changes (and it's not On Fri, Mar 29, 2013 at 5:49 PM, Stefan Karpinski
|
MATLAB's vector-is-a-matrix view might be convenient in some situations but if you plan to transpose your vector you could just write @tshort The timings are tiny but still julia> a=randn(100000);
julia> min([@elapsed a'' for i = 1:10])
0.000925552
julia> min([@elapsed reshape(a, length(a), 1) for i = 1:10])
6.67e-7 |
subsumed by JuliaLang/LinearAlgebra.jl#42 and #3262. |
This might need to be thought through a bit since it's a breaking change.
The text was updated successfully, but these errors were encountered: