help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memory management on Octave + writing .oct files


From: Quentin Spencer
Subject: Re: memory management on Octave + writing .oct files
Date: Fri, 17 Mar 2006 12:40:47 -0600
User-agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)

Agnes Bousquier wrote:

Hello everybody,

I am facing problems of slowness with my .m files, so I tried several ways to make them run faster, and have some questions :

1- Are there any routines which allows us to manage memory on Octave (like "malloc" and "free" for C language)?


If you want to pre-allocate arrays (which does increase speed in some cases), simply create an array of the correct dimensions using the zeros command. Using the "clear" command will clear an array from memory, and so is roughly equivalent to "free".

2- About .oct files : what should I do to call an Octave's function (like imshow) in a .oct file?

I don't know if it works for m files, but if you have another oct file function called func, you can call it from C using Ffunc.

Another general comment about speed in octave: make sure you are using vector functions where possible to avoid for loops. Seeing ways to do so takes a lot of familiarity with the language--some of the functions I wrote in the first years after I learned Matlab were much slower than they could have been. If you have specific examples of code that is slow, you could see if anyone here knows ways to make it faster.

-Quentin



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]