I think comparisons between those two will depend a lot on context. If you need 
to use linear algebra functions, the Array{Array{Float64, 1}, 1} approach won’t 
work at all, so it’ll be infinitely slow. If you’re constantly just grabbing 
columns stored that way, it might be faster since you might avoid some copying 
— at the moment, for an array, A, A[:, i] does a copy which you might slow 
things down depending on context.

 — John

On Mar 24, 2014, at 7:33 AM, Ethan Anderes <ethanande...@gmail.com> wrote:

> I'm definitely not an expert but I thought I would chime in on your "arrays 
> of arrays vrs matrices" question. 
> 
> I recently developed a project where I started out using: 
> Array{Array{Float64,1},1} as a container for a set of state vectors in an ODE 
> flow. This seemed most natural but I figured once I got it to work, I would 
> speed it up by representing everything in a compact matrix representation: 
> Array{Float64,2}. However, I was never able to speed things up much with 
> Array{Float64,2} over the Array{Array{Float64,1},1} container. 
> 
> I ended up with the impression  (experts can confirm or deny this) that 
> although Array{Float64,2} may be stored in memory more compactly than 
> Array{Array{Float64,1},1}, the latter container is already very efficient so 
> that any speed gains were marginal.
> 
> Is this the experience of others?
> 
> Cheers,
> Ethan

Reply via email to