You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I would like to know why julia doesn't treat an array of N dimensions with a singleton in one of the dimensions as an array of (N-1) dimensions.
To explain that a little bit let's say I have the following code.
In the second line you can see that the singleton dimension a[:,:,1] is converted to Array{Float64,2} reducing the dimensions. Nonetheless this effect doesn't happen with a[1,:,:] because it keeps the Array{Float64,3} dimension. So in the first case I'm able directly to do matrix operations because I have Array{Float64,2} but it's not the same in the second case because I have to transform Array{Float64,3} to Array{Float64,2} by reducing my singleton dimension.
My problem now is that this conversion I have to make it a lot of times in my case, because I use it in an iterative process. I fear that this can lead to performance problems just because of this conversion will slow down the process, any thoughts or recommendations?
The text was updated successfully, but these errors were encountered:
This has already been changed in julia v0.5, see PR #13612 . Note however that a[1,:,:] still copies the data, so this could still be costly in an iterative process if you don't actually need a copy and are satisfied with just a view. Then slice(a,1,:,:) is the way to go.
do you mean v0.45? I don't see any v0.5 in the tags on github. I'm asking in order to change to that version, because now I have the version provided by the ppa:staticfloat/juliareleases repositories on ubuntu 14.04
v0.5 is still in development, so I guess I should have said, this is changed on the master, which you can get e.g. as nightly built ( http://julialang.org/downloads/ ) or by cloning the github repository and building it yourself. But unless you explicitly need a copy, I think you want to use slice which works just fine on the current release version of julia.
Hello, I would like to know why julia doesn't treat an array of N dimensions with a singleton in one of the dimensions as an array of (N-1) dimensions.
To explain that a little bit let's say I have the following code.
In the second line you can see that the singleton dimension
a[:,:,1]
is converted toArray{Float64,2}
reducing the dimensions. Nonetheless this effect doesn't happen witha[1,:,:]
because it keeps theArray{Float64,3}
dimension. So in the first case I'm able directly to do matrix operations because I haveArray{Float64,2}
but it's not the same in the second case because I have to transformArray{Float64,3}
toArray{Float64,2}
by reducing my singleton dimension.I have the following options to resize it:
My problem now is that this conversion I have to make it a lot of times in my case, because I use it in an iterative process. I fear that this can lead to performance problems just because of this conversion will slow down the process, any thoughts or recommendations?
The text was updated successfully, but these errors were encountered: