All Questions
12
questions
1
vote
2
answers
145
views
Speed up calculation of recursively defined list
I have two lists $a$ and $b$ of length $n$ and $n-1$ respectively (typically I have $n \approx 1000$).
I have to compute a list $\theta$ of length $n$ which is defined recursively by the following ...
0
votes
0
answers
64
views
Compile error in recursive code due to large integer
I am trying to implement a compiled version for the original algorithm that is supposed to run faster . It works fine for small iteration loop number when max=100. However, when loop number gets ...
0
votes
1
answer
100
views
How can I use Compile to implement recurrence?
I am trying to make the code for the following recurrence. Here wjoin[[i]] is used for calling values from a data set and a is a ...
0
votes
0
answers
31
views
Compiling a recursive function [duplicate]
I'm trying to compile a recursive function that spits out the n-th Fibonacci number. I have a working uncompiled function, I just can't seem to get the compiled version working. Here's the code:
<...
2
votes
1
answer
204
views
Speeding up compilation of recursive functions
I am trying to understand how to speed up recursive functions via compilation. I am experimenting with the Fibonacci sequence (though this is not really what I want to do eventually). Can somebody ...
2
votes
1
answer
386
views
Speeding up this recursive function
I have a recursive function defined like this:
...
13
votes
3
answers
991
views
How to compile self-referencing functions (to perform recursive a task)
How do I compile a self-referencing function to perform iterative tasks?
The naive approach doesn't seem to work. Here is a simple example to illustrate the problem:
...
2
votes
2
answers
157
views
How to build recursive function which only remembers every pth value and the last two values?
I need to create a recursive function of the natural numbers $f$ which only remembers the last two values it has found and every $p$th value. Below is the form of the code that I am working with, but ...
6
votes
1
answer
784
views
Compile, "global variables" and recursion
I am trying to do something similar to this, namely to make a Compile'd function outer that itself calls a ...
11
votes
0
answers
944
views
Compile recursive function modifying global variables
How to compile recursive formula when it relies on more than a few global variables (global to the topmost compiled function)? It is unreasonable to pass on all such variables to each recursive ...
9
votes
1
answer
1k
views
Compiling a recursive formula
My question is related to computing what is called "invariant measure" for a particular well known fractal - the Sierpinski triangle.
We have an array m of four two by two matrices, say
...
13
votes
2
answers
511
views
Can RecurrenceTable make use of CompiledFunction?
I'm trying to implement a discrete-time 2D Verlet algorithm for a point-mass subject to a softened gravitational interaction as a test for a more computationally intensive simulation using ...