[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: structure vs. vector
From: |
Etienne Grossmann |
Subject: |
Re: structure vs. vector |
Date: |
Tue, 13 Feb 2001 14:46:33 GMT |
You are right !? Structures are quicker. What about then adding
sthing like :
if is_struct (ctl)
if struct_contains (ctl, "crit") && ! isnan (ctl.crit ), crit = ctl.crit ; end
if struct_contains (ctl, "tol") && ! isnan (ctl.tol ), tol = ctl.tol ; end
if struct_contains (ctl, "narg") && ! isnan (ctl.narg ), narg = ctl.narg ; end
if struct_contains (ctl,"maxev") && ! isnan (ctl.maxev), maxev = ctl.maxev; end
if struct_contains (ctl, "isz") && ! isnan (ctl.isz ), isz = ctl.isz ; end
if struct_contains (ctl, "rst") && ! isnan (ctl.rst ), rst = ctl.rst ; end
else
[old code]
end
So you can have a struct control variable or a vector control variable.
Or even, for about the same price (I guess) named variables by prefixing the
above code w/
if isstr (ctl) # Assume named arguments
ctl = struct (all_va_args);
end
In fact, there is some overhead, since struct calls eval ...
Etienne
-------------------------------------------------------------
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
-------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: structure vs. vector,
Etienne Grossmann <=