In Julia 0.2.1, I get 6.0. -- mb
On Mon, Mar 3, 2014 at 7:22 PM, Carlos Becker <carlosbec...@gmail.com>wrote: > My mistake there, I meant the L1 norm, re-typed: > > ----------------------------- > X= [[1 2 3],[4 5 6]] > > # now, X[1,:] is 1x3 array, containing 1 2 3 > > # but let's peek at its L1-norm: > norm( X[1,:], 1 ) # --> we get 3, where I would expect 6 (1+2+3) > ----------------------------- > > can you try that on v0.2? I am on 0.3 from upstream. > > > ------------------------------------------ > Carlos > > > On Tue, Mar 4, 2014 at 1:19 AM, Patrick O'Leary > <patrick.ole...@gmail.com>wrote: > >> This is odd, as I get norm() working just fine with any of a row, column, >> or vector, and all getting exactly the same result of 3.741... (v0.2.0, on >> julia.forio.com, since it's quick for me to get to). Note that it will >> return the L2 norm by default, exactly as MATLAB does. Supplying a second >> argument with p in it (norm([1 2 3], 1)) will return the p-norm, exactly >> like MATLAB. >> >> >> On Monday, March 3, 2014 6:12:53 PM UTC-6, Carlos Becker wrote: >>> >>> Hello all, >>> >>> today I fought for an hour with a very simple piece of code, of the kind: >>> >>> ----------------------------- >>> X= [[1 2 3],[4 5 6]] >>> >>> # now, X[1,:] is 1x3 array, containing 1 2 3 >>> >>> # but let's peek at its L1-norm: >>> norm( X[1,:] ) # --> we get 3, where I would expect 6 (1+2+3) >>> ----------------------------- >>> >>> I believe this comes back to the 'how 1xN matrices should be handled'. >>> The point is that the current behaviour is totally non-intuitive for >>> someone coming from Matlab, >>> and having matrix and vector norms in the same function hides this (in >>> this case) unwanted behavior. >>> >>> I am not sure what is the right way to deal with this, but seems like a >>> hard wall that more than one >>> will hit when coming from matlab-like backgrounds. >>> >>> Cheers. >>> >> >