Re: [julia-users] atleast_2d and atleast_3d

2015-03-06 Thread Júlio Hoffimann
Good point Tim, will check my code to see if I can drop this distinction between 2 and 3 dimensions. Thanks. -Júlio

Re: [julia-users] atleast_2d and atleast_3d

2015-03-06 Thread Tim Holy
atleast_2d{T}(A::Union(Array{T,0},Array{T,1})) = reshape(A, size(A,1), 1) atleast_2d{T}(A) = A but in general I'm not sure why you'd need such a function. size(A,2) returns 1 even if A is one-dimensional, and A[3,1] works as well. Best, --Tim On Friday, March 06, 2015 01:41:28 PM Júlio Hoffima

[julia-users] atleast_2d and atleast_3d

2015-03-06 Thread Júlio Hoffimann
Hi, What is the equivalent in Julia for numpy.atleast_2d and numpy.atleast_3d? Or how would you add a ghost dimension to an array in Julia without calling reshape(X, m, n, 1) explicitly? -Júlio