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

learn more… | top users | synonyms

0
votes
1answer
37 views

Compile with modification of arguments' values

Is it possible to compile while changing the value of the arguments the function receives, instead of just creating new variables, and then returning those new variables,i.e., is it possible to pass ...
9
votes
0answers
150 views

Compile not correctly initializing a variable defined inside Module

In the following example, inside the minimumX's Module, x is initialized to 1, but the ...
8
votes
0answers
149 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 ...
7
votes
0answers
254 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 ...
7
votes
0answers
243 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 ...
6
votes
0answers
53 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: ...
6
votes
0answers
114 views

Exporting a compiled function for later use

I compiled a function then used it in NMinimize. The computation took 19 seconds. Then, I exported this compiled function and restarted MMA and imported this ...
6
votes
0answers
97 views

Compiled function crashes kernel when trying to list over different length arguments

I'm trying to speed up a tally/binning operation that I have to run many times. I have many lists of between 1 and 10 numbers from the range [1,5] and I want to ...
5
votes
0answers
390 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 ...
3
votes
0answers
39 views

CompiledFunction with multiple outputs of different ranks

Below is a simple compiled function f that gives multiple outputs. ...
3
votes
0answers
76 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 ...
2
votes
0answers
79 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
36 views

Compiled DiagonalMatrix

The standard function DiagonalMatrix cannot be compiled, so I tried writing my own: ...
2
votes
0answers
39 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 ...
2
votes
0answers
218 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
149 views
1
vote
0answers
33 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 ...
1
vote
0answers
38 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 ...
1
vote
0answers
89 views

Compiler stack overflow

I tried to compile a huge function. I used these options: ...
1
vote
0answers
136 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
71 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
66 views

Linear interpolation over 2 variables

I'm tuning a function to data over 4-5 variables using Differential Evolution. The objective function calls frequently interpolation function. I came to a point, where compiling the objective function ...
1
vote
0answers
58 views

Challenge: Creating Compilable Permutations Function

As Mathematica's implemented Permuations function is not compilable I tried to write my very own Permutations implementation, called ...
1
vote
0answers
89 views

Compiled version of user-defined function

I have a function for parameter estimation with these codes: ...
1
vote
0answers
161 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
76 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
69 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
44 views

Evaluation inside Compile

here's a simple question: I have a function: ...
0
votes
0answers
55 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
67 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
36 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. ...
0
votes
0answers
53 views

How to compile a function whose arguments are list?

I'm unsuccessfully trying to compile this function check[argA_, argB_] := argA[[1]] == argB[[1]]; assuming that both arguments argA and argB are of the form ...