I want to check some Scilab functions written in Scilab against what are
putatively the same functions written in C.
The reason is that I have a set of code that I'm developing where, for
speed, I use the C functions, but for compatibility I distribute the
Scilab functions (the recipients are using Windows, I'm using Linux, I
don't want to walk them through building Scilab functions from C and they
don't want to learn). The problem is that there is some discrepancy --
one should be able to run the code with either set of functions and get
the same result, but I am seeing markedly different results with the two
function sets.
I would like to have a mechanism for having the two sets of functions
residing on the same Scilab runtime, but with different names. Then I
can do something like:
if (foo_c(a) ~= foo_sci(a)) then freak_out(); end
The only mechanism that I know for doing this involves manually renaming
functions in files -- is there a better way?
Thanks.
Not sure if this is any help, but
You can rename functions on the fly (blank lines removed from output)
-->function y = foo(x)
-->y = sin(x);
-->endfunction;
-->foo2=foo
foo2 =
[y]=foo2(x)
-->foo2(%pi)
ans =
1.225E-16
-->function y = foo(x)
-->y = cos(x)
-->endfunction
Warning :redefining function: foo
-->foo(%pi)
ans =
- 1.
-->foo2(%pi)
ans =
1.225E-16
--
Steven Bellenot http://www.math.fsu.edu/~bellenot
Professor and Associate Chair phone: (850) 644-7405
Department of Mathematics office: 223 Love
Florida State University email: bellenot at math.fsu.edu
Huh. I assumed that the foo2 = foo just aliased foo2 to whatever foo was
-- it appears that it's saved. This is cool; this is cool.