[Top][All Lists]

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

Re: Need some help with Oct files

From: Michael Creel
Subject: Re: Need some help with Oct files
Date: Tue, 05 Sep 2006 16:25:23 +0200
User-agent: Thunderbird (X11/20060812)

John W. Eaton wrote:
On  5-Sep-2006, Michael Creel wrote:

| You need to return an octave_list_value. Something like the following | (taken from in octave-forge): | | f_return(0) = xopt;
|       f_return(1) = fopt;
|       f_return(2) = converge;
|       return octave_value_list(f_return);

More like

  octave_value_list retval;

  retval(2) = converge;
  retval(1) = fopt;
  retval(0) = xopt;

  return retval;

Since the list has to be declared before it can be used.

The () operator forces a resize of the list automatically, so loading
the values in reverse order requires just one resize.


That's interesting. Of course, makes the declaration in the part that is omitted - I pointed Philip to a specific file so he can get a working example. But I hadn't thought of the ordering affecting the number of resizings. Would the reverse order be expected to have a noticeable effect on the time it takes the function to evaluate? I'm guessing that this would only be the case if the things in the list used substantial memory or if it were called frequently. Is that correct?

reply via email to

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