I (think I) would be in favor of changing [1; 2; 3] to mean a 1-column matrix. Arguments against?
Kevin On Tue, Feb 24, 2015 at 11:45 AM, Bill Hart <goodwillh...@googlemail.com> wrote: > Julia distinguishes between them at the level of types, yes. I was talking > about the syntax for creating them. There they become conflated. > > [1; 2; 3] is precisely the same thing as [1, 2, 3] > > Sorry for not being clearer about that. > > It's clear this is done intentionally, not accidentally. It's just > extremely confusing and I'll bet it will bite somewhere down the track. > It's especially bad for metaprogramming for example. > > Bill. > > On 24 February 2015 at 20:39, David P. Sanders <dpsand...@gmail.com> > wrote: > >> >> >> El martes, 24 de febrero de 2015, 8:18:28 (UTC-6), Bill Hart escribió: >>> >>> The specific use case where I hit this as a problem is in wrapping >>> external libraries like flint and pari, which unlike julia do not conflate >>> 1xn matrices with flat arrays. >>> >>> However, I have just realised that Julia only conflates column vectors >>> with flat arrays, not row vectors. >>> >> >> That is not my interpretation. Julia carefully distinguishes between the >> different options: >> >> (i) a 1D object (which could be called a "vector"), i.e. with 1 index >> (what I understand you mean by "flat array"): >> >> julia> v = [3, 4, 5, 6] >> 4-element Array{Int64,1}: >> 3 >> 4 >> 5 >> 6 >> >> This is (unfortunately?) displayed in a column, but is just a >> one-dimensional list of things. >> >> (ii) A matrix object of size 1 x n (which could be called a "row >> vector", but is actually a matrix): >> >> julia> w = [3 4 5 6] >> 1x4 Array{Int64,2}: >> 3 4 5 6 >> >> (iii) A matrix of size n x 1 (which could be called a "column vector", >> but is actually a matrix): >> julia> z = reshape([3, 4, 5, 6], (4,1)) >> 4x1 Array{Int64,2}: >> 3 >> 4 >> 5 >> 6 >> >> (The output looks superficially the same as that for v, but the object is >> of a different type -- Array{Int64, 2} vs. Array{Int64, 1}. I.e. there are >> now *two* indices.) >> >> I do not find the nomenclature "row vector" and "column vector" useful in >> this (or almost any other!) context. >> >> David. >> >> >> >>> >>> Therefore I can overload my constructor for the external flint and pari >>> types to interpret Julia flat arrays as column vectors. Fortunately, I only >>> need to do that in one place. I can't imagine overloading every single >>> function for every possible combination of flat array vs matrix for each >>> parameter to the function. >>> >>> The only reason I did things that way is because I initially thought >>> Julia arrays had cartesian product semantics (pointwise operations) rather >>> than matrix semantics. >>> >>> So actually, I guess I can live with the way things are right now. >>> >>> On 24 February 2015 at 14:29, Jiahao Chen <jia...@mit.edu> wrote: >>> >>>> Clearly Julia wants to deliberately conflate row and column vectors, >>>>> which is fine if you aren't working with an algorithm that depends on the >>>>> individual dimensions of your matrices, and you aren't interfacing to an >>>>> external library. >>>>> >>>> >>>> Could you elaborate on what you mean here? As part of Issue #4474 I've >>>> been trying to collect specific examples. >>>> >>> >>> >