It really depends on what you're trying to achieve. Low memory usage? Speed?

Also consider:

http://julia.readthedocs.org/en/release-0.3/stdlib/arrays/#Base.sub

That should work even better in 0.4. It'll give you an object that behaves 
like what you asked for, but it won't actually free the memory. 

On Monday, September 7, 2015 at 5:17:41 PM UTC-4, Sheehan Olver wrote:
>
> Just curious: if it was [true,true,false] or [false,true,true] would it 
> then be possible?  The memory for a matrix is still inline, so these cases 
> should correspond to changing the dimensions or rebasing the initial 
> column.  
>
> On Tuesday, September 8, 2015 at 4:10:07 AM UTC+10, Tomas Lycken wrote:
>>
>> No, that's not possible, at least not in general - to do that, you would 
>> have to at least shift all the elements of the columns after the deleted 
>> one to make the matrix memory layout consistent.
>>
>> What you can do, if you don't need to use the matrix as an actual matrix, 
>> is to use e.g. a Vector{Vector{Float64}} instead of a Matrix{Float64}. That 
>> gives you a vector of columns with which you can add and delete columns at 
>> will. However, it will be much more expensive to address this data 
>> structure by rows, since you will lose cache-locality.
>>
>> // T
>>
>> On Sunday, September 6, 2015 at 11:29:39 PM UTC+2, Diego Javier Zea wrote:
>>>
>>> Is there some function for deleting columns in-place? I want to do 
>>> something like the next, but changing the matrix in-place.
>>>
>>> julia> mat = [ 1 2 3
>>>        4 5 6 ]
>>> 2x3 Array{Int64,2}:
>>>  1  2  3
>>>  4  5  6
>>>
>>> julia> mat[:, [true, false, true]]
>>> 2x2 Array{Int64,2}:
>>>  1  3
>>>  4  6
>>>
>>>
>>> Thanks in advance!
>>>
>>

Reply via email to