Skip to main content

All Questions

Tagged with
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 ...
Matteo's user avatar
  • 283
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 ...
Aschoolar's user avatar
  • 893
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 ...
a b's user avatar
  • 151
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: <...
RKLS's user avatar
  • 1
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 ...
Asim's user avatar
  • 1,150
2 votes
1 answer
386 views

Speeding up this recursive function

I have a recursive function defined like this: ...
z.v.'s user avatar
  • 189
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: ...
QuantumDot's user avatar
  • 19.7k
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 ...
math_et_physics's user avatar
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 ...
Marius Ladegård Meyer's user avatar
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 ...
István Zachar's user avatar
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 ...
arkajad's user avatar
  • 581
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 ...
Editortoise-Composerpent's user avatar