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

learn more… | top users | synonyms

19
votes
0answers
262 views

Compile not correctly initializing a variable defined inside Module

Bug introduced in 8.0 and persisting through 10.3.1 or later In the following example, inside the minimumX's Module, ...
11
votes
0answers
202 views

Memory usage of compiled function: C vs WVM

Reported to WRI [CASE:3406803] Why does generating an array in "C"-compiled function uses 50% more memory than doing same thing in ...
10
votes
0answers
204 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 list-...
10
votes
0answers
589 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
578 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
199 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
186 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
367 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 ...
5
votes
0answers
82 views

Does Compilation option “InlineExternalDefinitions”/“InlineCompiledFunctions” lead to unnecessarily complicated nesting?

Question: When an external (possibly complicated) definition f is used inside a compiled function with ...
5
votes
0answers
109 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
514 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
97 views

Is it possible to prohibit unnecessary CopyTensor in Compile? Just like .noalias() in Eigen library?

Turn on Needs["CompiledFunctionTools`"] First example ...
4
votes
0answers
93 views

Improving the speed of an optimization algorithm via compilation and parallellization

I have written an implementation of eight variants of the PSO-algorithm and I want to test them over a set of test functions. I am using parallelization as it improves the speed a lot and I have also, ...
4
votes
0answers
155 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
145 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
45 views

weird behaviour of Listable fortran Librarylink function: different result each evaluation

I am working with fotran librarylink function currently. In this post, I will show some weird result of Listable fortran librarylink generated by intel compiler under windows (I tried gcc on linux the ...
3
votes
0answers
93 views

Goto and Compile to C

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

How to use Compile? Bivariate Gibbs Sampler

I am trying to use compile to speed up my Gibbs sampler. I know I can use Reap and Sow to speed up tremendously. I have a more complicated Bayesian posterior that I want to speed up with compile so I ...
2
votes
0answers
110 views

integration of a list of gaussian type orbitals (GTO)

I am currently trying to integrate various components of a current density (j={jx,jy,jz}) over space. The problem is that the current j is extracted from a quantum chemical computation and is a sum of ...
2
votes
0answers
76 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
102 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
42 views

Compiled DiagonalMatrix

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

How to speedup Plot3D with precompiled argument

I have a huge problem with my code: I estimate it to take hours to run. The scheme of the code is the following (I left the steps the same, but took much simpler functions): ...
1
vote
0answers
73 views

Compiled function and integration

I'm using the recursive functions defined here: MyFnc and myFncC (compiled version). I want to call this functions in the ...
1
vote
0answers
54 views

Compilation error: “Could not complete external evaluation at…”

I'm pretty new to trying to use Compile[], and I just can't see why I'm getting this error. I have two functions to define beforehand; one of them is a bit odd: <...
1
vote
0answers
57 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
75 views

Evaluation inside Compile

here's a simple question: I have a function: ...
1
vote
0answers
299 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
85 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
39 views

Compiling LinearSolve with 2 complex matrices, possible bug

Take two complex matrices depending on one variable, for example: ...
0
votes
0answers
49 views

Problem with Greater in Compile

I am relatively inexperienced with Mathematica so I apologize for the possibly simple question. I have written the following function which should receive a matrix as input. If I compile this, ...
0
votes
0answers
77 views

How to compile code that involve sparse array?

I have the following code ...
0
votes
0answers
85 views

Nestlist inside Compile

My question is a continuation of question1 and question2, but I think it may be considered as a self-contained one. I am interested to make the following code faster ...
0
votes
0answers
62 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
301 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
73 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 ...