In lieu of intelligence, one can always use pragmas to identify types.
E.g.,
%% int i
%% double t, x[]
t=0; for i=1:n, t += x(i); end
You can even do this in octave code instead of special syntax:
x=double(x);
t=double(0); for i=int(1:n), t += x(i); end
but you need some way to make sure that double, int, etc. always
return values of the right type, even in the presence of dispatch, oct
files, user defined types, etc.
- Paul
On Feb 22, 2004, at 10:46 AM, Paul Thomas wrote:
JD and Jens,
Have you given any thought yet as to how you will do the C++ generation?
I suppose that a first order approach would be, in essence, to output
the octave evaluator code. However, I suspect that the performance
improvement over that of the interpreter/evaluator will not be as
impressive as writing .oct files "by hand". Therefore, the trick is
going to be to improve on the evaluator, particularly where type
identification, indirect referencing and bound checking is concerned.
Once you do that, the strategy you have adopted should allow to
similarly improve octave's evaluator, should it not?
Paul Thomas