Questions about the generation and use of compiled functions using Compile.

learn more… | top users | synonyms

4
votes
1answer
111 views

Challenge: Creating Compilable Permutations Function

As Mathematica's implemented Permutations function is not compilable I tried to write my very own Permutations implementation, called ...
18
votes
0answers
151 views

Listable compiled function crashes the kernel with “no more memory available”

Bug introduced in 9.0.0 and persisting through 10.2.0 I am trying to speed up a function that involves continued fractions. Since ContinuedFraction cannot be ...
15
votes
0answers
222 views

Compile not correctly initializing a variable defined inside Module

Bug introduced in 8.0 and persisting through 10.1.0 or later In the following example, inside the minimumX's Module, ...
10
votes
0answers
418 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
0answers
111 views

Memory usage of compiled function: C vs WVM

Why does generating an array in "C"-compiled function uses 50% more memory than doing same thing in "WVM"-compiled function? ...
9
votes
0answers
174 views

Check whether a working CCompiler is installed

Let me give a bit background: As many of my answers imply, I often use the auto-parallelization (meaning, that Mathematica distributes the calculation automatically over several cores when ...
9
votes
0answers
266 views

Using Compile to speed up Function with PermutationProduct

I have the following fairly simple routine dot involving PermutationProduct that I wish to speed up using ...
8
votes
0answers
196 views

Step-by-step instruction to Install C Compiler

I remember using C compiler on my previous computers, and I never had any problems installing them. At this time, however, I failed to work through the instructions provided in Mathematica ...
7
votes
0answers
148 views

What is a good way to code long, complex, compilable algorithms?

The functional paradigm of the Wolfram Language used in Mathematica is all around wonderful. For intense numerics, Mathematica comes with the ability to Compile ...
6
votes
0answers
112 views

Fine tuning compiled code that computes dilogarithm function

As an exercise of writing a good Compile function, I want to do the simple task of coding a routine that outputs the real part of the dilogarithm function ...
6
votes
0answers
70 views

Listable compiled functions used in NMinimize

This is an example from MMA: cListable = Compile[{x}, (x-1)^2, RuntimeAttributes -> {Listable}] In case of single entry: ...
5
votes
0answers
82 views

Compiling FoldList implementation for RK4

Original I'm looking to write an integrator for a function of two variables. Here is my implementation for the RK4 update rule using FoldList. ...
5
votes
0answers
478 views

Having problems compiling Mathematica Cuda code

Ok I am trying to follow the examples of Cuda Code in the docummentation Run the CUDAQ[] and get back a True and run some of ...
4
votes
0answers
120 views

CompilationTarget to C takes long compilation time

Consider I have a function, with one version that compiled to the virtual machine and one that compiled to C: ...
4
votes
0answers
57 views

CompiledFunction with multiple outputs of different ranks

Below is a simple compiled function f that gives multiple outputs. ...
4
votes
0answers
136 views

Is it possible to Compile the function with string argument?

As we can see from the Compile documentation, the typical arguments for Compile should be ...
3
votes
0answers
72 views

Why Function is compiled?

Function isn't mentioned in the list of compilable function, but it can generally be compiled when it's formed by compilable functions, a simple example is: ...
3
votes
0answers
78 views

speed up evaluating a listable function

I apologize in advance for the vagueness, but I can't think of a more descriptive title. I am trying to find the average value of the square of BesselJ[0, x] ...
3
votes
0answers
39 views

Escaping out of (or exiting) a Compiled Function

How do I manually escape out of a compiled function without forcing an error and compromising its speed? Here is an example: ...
3
votes
0answers
111 views

Compiling/calling Mathematica-generated .so from C

I'm trying to call a compiled function from a C program. I am generating the static object ...
3
votes
0answers
287 views

Listing over multiple inputs (tensor rank > 1) in a compiled function

I'm trying to optimize the solution given by Michael E2 to my previous problem (Efficiently determining if 3D points are within a surface composed of polygons) which I figured would be relatively ...
2
votes
0answers
66 views

Goto and Compile to C

When I use Goto inside compile and use CompilationTarget->"C" I get error message: ...
2
votes
0answers
58 views

Compilation of a function that needs to call Subsets

I'm working on a code that runs many (easy) operations on combinations (subsets) of different size (6, 7, 8, 9) taken from a big set of numbers (normally more that 40). So, this means the code has to ...
2
votes
0answers
98 views

How to use a C compiler without having SystemModeler

In this question the answer given implies that I must compile a certain function. When I try to compile I get the error A C compiler cannot be found on your system. Please consult the ...
2
votes
0answers
94 views

Compile issues, scoping and order of evaluation

I have a few questions about compiling functions, which I think are all related to scoping and order of evaluation. I will illustrate them by a minimal example of the problem I have. I'm sorry for ...
2
votes
0answers
40 views

Compiled DiagonalMatrix

The standard function DiagonalMatrix cannot be compiled, so I tried writing my own: ...
2
votes
0answers
156 views
1
vote
0answers
120 views

How to use Wolfram language in an external program with low latency?

Im using Wolfram language on Pi B,and I want to compile a '.m' file (like "test.m" that contains Wolfram functions), in an external program like a C/C++ and then Export the output in an image file ...
1
vote
0answers
99 views

How to get Mathematica to compile with target C?

I have been trying to compile some functions in mathematica with target C for speed. basically when I try: ...
1
vote
0answers
50 views

Complex input for Compile makes it slow

I asked a question here and then tried to use Compile for the solution to gain even more speed. Inside Compile there is a loop ...
1
vote
0answers
124 views

Compiler stack overflow

I tried to compile a huge function. I used these options: ...
1
vote
0answers
221 views

Speeding Up Image Processing Functions

I am working with stacks of 1024x1024 timelapse microscopy images that I am performing a series of image processing functions on to help segment each image. These functions include ...
1
vote
0answers
75 views

When to use Compile

I am new to Mathematica and have a general question: Working with matrices I have the impression that Compile can only be used if the elements of a matrix are ONLY Integers or ONLY Reals. No mixed ...
1
vote
0answers
93 views

Compiled version of user-defined function

I have a function for parameter estimation with these codes: ...
1
vote
0answers
287 views

Using Part within a Compiled Command

I'm looking to define a multi-line function that makes use of the "Part" command. A toy example: ...
1
vote
0answers
84 views

How can I compile function with Apply?

For example, I tried to compile this function but Mathematica gives "The only function arguments supported are Times, Plus, or List", I have no a way to compile this. ...
0
votes
0answers
84 views

Numeric error in trivial compilation

I came across this strange problem: dd = Compile[{}, Abs[(10^-200 + 10^-200 I)/(10^-200 + I 10^-200)]^2, CompilationTarget -> "C"] dd[] ...
0
votes
0answers
57 views

Is tensor argument passing to module expensive?

I wrote a simple module which is supposed to do recursive computation, however it turns out to be expensive even for 300 points. I am not sure why is it slow, all the computations seem to be ...
0
votes
0answers
48 views

Compilable function with the functionality of SingularValueList

I'm doing something that involves finding the singular values of a lot of matrices. Basically I need to find singular values of $n$ matrices of dimension $n\times n$, where $n$ is as large as ...
0
votes
0answers
70 views

Bizarre Compile Error, changing one symbol

I am trying to compile the following code: ...
0
votes
0answers
25 views
0
votes
0answers
183 views

Mathematica cannot find the c compiler

I installed Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 Then, I installed Mathematica 10 trial version. I did: ...
0
votes
0answers
52 views

Evaluation inside Compile

here's a simple question: I have a function: ...
0
votes
0answers
64 views

Regarding CompilationTarget->“C”

Recently I have read some interesting things about CompilationTarget->"C" on SE, e.g. in http://mathematica.stackexchange.com/a/54459/11116 where @MichaelE2 ...
0
votes
0answers
70 views

Compile without hardcoding

My question is how to pre-compile the rules1, rules2 and result parts of the following Module code without hard-coding the many (and changing number of) variables and rather complicated equations: ...
0
votes
0answers
50 views

Get rid of external library dependency

I am trying to generate C code for some functions, which I do not post in full because they are a few hundred lines long. The functions do nothing too fancy: a bunch of dot products, powers and roots. ...