Dynamic Matrices in Matlab and Octave

For other users of Matlab / Octave, I’ve noticed that dynamically increasing the size of a matrix in Matlab is slower than initializing the matrix to a size that is certain to be larger than necessary, and then deleting the unused entries.

I work in Octave, so perhaps Matlab is different, but the impact on runtime is measurable in my experience, so I thought I’d share this observation.


Discover more from Information Overload

Subscribe to get the latest posts sent to your email.

Leave a comment