Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Renaming Scilab Functions

17 views
Skip to first unread message

Tim Wescott

unread,
Dec 10, 2009, 5:48:37 PM12/10/09
to
I think I'm out of luck, but I'll try anyway:

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.

--
www.wescottdesign.com

fake...@invalid.domain

unread,
Dec 11, 2009, 10:24:55 AM12/11/09
to
In article <Xa2dnTPXi-1Y57zW...@web-ster.com>,

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

Tim Wescott

unread,
Dec 11, 2009, 1:20:33 PM12/11/09
to

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.

--
www.wescottdesign.com

0 new messages