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

learn more… | top users | synonyms

4
votes
2answers
122 views

Improve simulation speed using Compile

I have two square matrices, a hermitian matrix h and an unitary matrix v. I am interested in the following function ...
6
votes
1answer
227 views

Compiling a function that takes lots of optional arguments

I have a function that takes lots of optional arguments (basically some design parameters, about 10 of them) and performs some basic algebraic calculations involving complex numbers with the options. ...
11
votes
1answer
142 views

CompiledFunctionCall vs. LibraryFunction

When compiling code to C, and the compiled code calls other compiled functions, I see CompiledFunctionCall in the output of ...
9
votes
1answer
391 views

Save a C compiled function without losing the blessing of C compiler

Consider the following example: ...
2
votes
3answers
74 views

NIntegrate-ing a compiled function

I'm trying to integrate numerically in 6 dimensions a very long expression and I read about the option to NIntegrate a compiled function which should be faster. ...
5
votes
2answers
100 views

A problem with Compile and Map

There is a weird behavior of Compile that I do not understand. Consider the following example: ...
2
votes
1answer
54 views

Error from Compile with a sum over two indices

I have the following code: ...
0
votes
0answers
66 views

Bizarre Compile Error, changing one symbol

I am trying to compile the following code: ...
0
votes
1answer
45 views

What is the meaning of the lists of numbers in the FullForm of a compiled function?

For example, f = Compile[{{x, _Real}}, x]; FullForm[f] has this output: ...
0
votes
1answer
62 views

Why does Compile redo the calculation when overflow happens?

When implementing the Numerov method solving Schrodinger equation, I encountered this problem. In order to show the order of the evaluation, Print is added. ...
0
votes
2answers
96 views

Numerical 3D Integration in Mathematica [closed]

My question in short is: Is it possible to make numerical 3D integration in mathematica efficiently? Or am I gonna have to move this to C++? I feel this problem is way too trivial to go to C++, so ...
7
votes
0answers
119 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 ...
5
votes
1answer
93 views

Compilation of `Total` with CompensatedSummation

I sometimes obtain an unexpected error when trying to call a compiled version of Total with compensated summation turned on. More specifically I define ...
1
vote
0answers
66 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: ...
5
votes
1answer
190 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 ...
0
votes
0answers
24 views

Returning multiple results from compiled functions in M10 [duplicate]

I have found a similar question from 2012 here. It has been 3 years now and we have version 10. Have there been any attempt to solve this problem either by Wolfram or by the community - how to return ...
3
votes
2answers
118 views

Dynamic arrays and lists with compile (Append, Linked lists etc.)

I have a code that I need to compile. The code contains a loop in which I need to gather data into a list. The question is how to best gather data so that the code works inside Compile. The following ...
0
votes
1answer
64 views

Correct use of Solve inside Compile

I have a function that behaves itself, but I want to make it much faster so I tried to put it into a compilable form After much fiddling I can't get it to work. Here's one of my failed attempts: ...
2
votes
1answer
46 views

Why do messages only appear first time I evaluate my compiled function?

I declare my compiled function: ...
5
votes
1answer
114 views

Slow-down encountered when using NMinimize with a compiled function

I'm minimizing a large function. Evaluating the function is very slow symbolically but using Compile I can get ~100x speed-up on this step. However, despite this, the NMinimize process is only ...
2
votes
0answers
57 views

Goto and Compile to C

When I use Goto inside compile and use CompilationTarget->"C" I get error message: ...
4
votes
1answer
133 views

Throw and Catch return wrong result inside Compile

Consider this code: fun = Compile[{{i, _Integer}}, Catch[Do[ If[j >= i, Throw[j]] , {j, 1, 10}]] ] I put an integer as argument then if this ...
1
vote
1answer
68 views

Throw and Catch or Return inside Compile

Consider this code: ...
3
votes
1answer
70 views

Package and imbricated compiled functions

I would like to build up a Mathematica package Pck which contains compiled functions. However when loading this library I obtain an error. When reduced to a minimal ...
5
votes
1answer
189 views

Is there any strategy to have a compiled version of FindFit or NonlinearModelFit?

Disclaimer: This is not a precise question with a definite answer. I know that neither FindFit nor NonlinearModelFit is in the ...
2
votes
1answer
179 views

Compile a MeijerG function [duplicate]

I am not very experienced with Compile, I tried to use it for a Meijer-G function ...
1
vote
0answers
47 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 ...
4
votes
1answer
113 views

A problem about CompilationTarget -> “C” [duplicate]

In my Windows 7 system, I installed two Mathematica versions (V8 and V9) In V8 Compile[ {{x}}, x^2 + Sin[x^2], CompilationTarget -> "C"] ...
1
vote
1answer
80 views

Compiling If statement

I have this code: ...
3
votes
1answer
60 views

Is it possible to change the MinPrecision in command “Compile”?

I'm using "Compile" to do some numerical calculation and I need high Precision. I was wondering if it is possible to change the Precision in command "Compile" to some $MinPrecision?
0
votes
2answers
80 views

Compile a Module wich has a loop with undetermined bound

Suppose I have such a module as below: test[int_] := Module[{m}, m = Table[i, {i, 1, 10}]; Do[m[[i]] = i*i, {i, 1, int}]; Return[m] ] The bound for ...
4
votes
1answer
101 views

Why is C-compiled (but not WVM-compiled) code so slow in Manipulate?

Here is a small section of code from this SE question which computes the real part of the dilogarithm (the upper limit of the sum is increased for demonstration purposes): ...
3
votes
1answer
161 views

How can I trans-compile Mathematica into another language?

I'm looking for an exhaustive list of source-to-source compilers to all other languages, if any exist that is.
3
votes
0answers
36 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: ...
1
vote
1answer
133 views

Finding the index of (x,y) pairs in a list

I have a large list of $(x,y)$ pairs, and I want to find the index of a particular pair in order to extract some data from another array. By way of an example, ...
1
vote
0answers
48 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
1answer
138 views

i cannot create a standalone executable from an exported Mathematica function

I generated the C code: compute.c ...
1
vote
1answer
95 views

Apply functions to functions yields slow execution speed

I'm trying to write a function that parametrizes a curve c(t) by its arc length. Technicly I'm finished but if I plot the result for an example curve like ...
1
vote
1answer
106 views

Use Compile to speed up evaluation

I have read, that using Compile command can speed up evaluations in mathematica. I have a mathematical expression, which I evaluate using following command: ...
4
votes
2answers
98 views

Generating compiled functions from inactive expressions

I am working on a project in which I need to dynamically generate CompiledFunctions from Inactive expressions. For example, I ...
2
votes
1answer
88 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 ...
2
votes
0answers
85 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
1answer
97 views

Problem using Compiled Function within NProbability

I've built a very simple function to estimate the probability for a Long Straddle (derivative strategy) to be positive at expiration. ...
0
votes
1answer
127 views

How to Use Mathematica as a C/C++ compiler [closed]

I am learning C/C++ programming, but I don't wannna install new software for compiling C/C++, so, is there any possibility to compile C/C++ code using Mathematica? Here is the first program I want to ...
0
votes
0answers
24 views
2
votes
0answers
54 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 ...
7
votes
2answers
170 views

Catching error in middle of evaluation of compiled function

I have programmed and Compileed a complicated numerical function. The function has singularities (i.e. are infinite) at certain input numerical values. I need to ...
17
votes
1answer
652 views

Has this implementation of FDM touched the speed limit of Mathematica?

Still, I'll use the implementation of the 1D FDTD method (you can simply understand it as a kind of explicit finite difference scheme for the Maxwell's equation) as the example. Just for completeness, ...
6
votes
3answers
223 views

How to use a compiled function in numerical optimization

I'm trying to wrap my head around function Compile. So, this is a spin-off question from: a previous question on using compile[] correctly. I have a function that ...