[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: Calling other functions from .oct files

**From**: |
John W. Eaton |

**Subject**: |
Re: Calling other functions from .oct files |

**Date**: |
Thu, 1 May 2003 10:11:43 -0500 |

On 1-May-2003, Peter Williams <address@hidden> wrote:
| That did the trick. I'm looking to speed up some monte carlos that
| I've got and the real bottleneck is updating the paths.
Then you don't really want to be using feval. It will still be slow.
If you use Octave 2.1.46, then you can call rand directly, without
having to go through feval, because the guts of the rand function have
been moved to a liboctave class instead of being defined directly in a
DEFUN function. Execution speed was the reason for the move -- I was
doing something similar to what you are now doing.
If you want a matrix of uniformly distributed random numbers:
#include <octave/oct.h>
#include <octave/oct-rand.h>
Matrix uniform_random_numbers = octave_rand::Matrix (M, N);
You can set the seed using
octave_rand::seed (d);
or choose the distribution with
octave_rand::uniform_distribution ();
or
octave_rand::distribution ("uniform");
etc. Look at oct-rand.h for details of the rest of the interface.
jwe
-------------------------------------------------------------
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
-------------------------------------------------------------