-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive functions are rather slow #1067
Labels
Milestone
Comments
Hi, Contributions and feedbacks are welcome !!! |
fibonacci recursive algo can be converted to non-recursive: function last_fibonacci = fib2(n)
fib_sequence = zeros(1, n);
fib_sequence(1) = 1;
fib_sequence(2) = 1;
for i = 3:n
fib_sequence(i) = fib_sequence(i-1) + fib_sequence(i-2);
end
last_fibonacci = fib_sequence(end);
end
|
Nelson-numerical-software
added a commit
that referenced
this issue
Dec 30, 2023
to test: >> addpath('d:/')
>> timeit(@fib, 1, 25) |
Nelson-numerical-software
added a commit
that referenced
this issue
Dec 30, 2023
Nelson-numerical-software
added a commit
that referenced
this issue
Dec 31, 2023
Nelson-numerical-software
added a commit
that referenced
this issue
Dec 31, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in Nelson 0.7.12.0
in Balisc/Scilab
It is not important to me, but I was just a little bit surprised, anyway I really like the evolution of Nelson.
The text was updated successfully, but these errors were encountered: