The function
function y = testrecursionfunc (f, x, n)
functions(f);
if (nargin < 3)
n = 0;
endif
if (n > 2)
y = f (x);
else
n++;
y = testrecursionfunc (@(x) f(2*x), x, n);
endif
endfunction
demonstrates an issue with the function handles with the new symbol
table code. With 3.0.1 this returns
octave:1> testrecursionfunc (@(x) x, 1)
ans =
{
function = @(x) x
type = anonymous
file =
}
ans =
{
function = @(x) f (2 * x)
type = anonymous
file =
workspace =
{
f =
@(x) x
}
}
ans =
{
function = @(x) f (2 * x)
type = anonymous
file =
workspace =
{
f =
@(x) f (2 * x)
}
}
ans = 4
whereas with the current repository it returns
octave:1> testrecursionfunc(@(x) x, 1)
ans =
{
function = @(x) x
type = anonymous
file =
}
ans =
{
function = @(x) f (2 * x)
type = anonymous
file =
}
ans =
{
function = @(x) f (2 * x)
type = anonymous
file =
}
error: `f' undefined near line 12 column 33
error: evaluating argument list element number 1
error: called from `?unknown?'
error: evaluating assignment expression near line 9, column 7
error: evaluating if command near line 8, column 3
error: called from `testrecursionfunc' in file
`/home/adb014/nobackup/perso/octave/testrecursionfunc.m'
error: evaluating assignment expression near line 12, column 7
error: evaluating if command near line 8, column 3
error: called from `testrecursionfunc' in file
`/home/adb014/nobackup/perso/octave/testrecursionfunc.m'
error: evaluating assignment expression near line 12, column 7
error: evaluating if command near line 8, column 3
error: called from `testrecursionfunc' in file
`/home/adb014/nobackup/perso/octave/testrecursionfunc.m'
It seems the workspace with recursive function handles is being lost
somewhere. This is an issue for me since it means that I can't do
variable substitution on a function handle to avoid singularities in a
quadrature, or at least not for a double integral. It seems to work for
the first recursion even if the workspace of the function handle is not
shown by functions and so I can do variable substitution on a 1-D integral.
I don't really understand yet the new symbol table code, so I have no
ideas what is causing this issue.
Regards
David
--
David Bateman David.Bateman at motorola.com
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary