# Tagged Questions

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

131 views

### My introduction to Compile

I am reading Fractals from the Newton-Raphson method from Peter Young's page [http://young.physics.ucsc.edu/115/]{http://young.physics.ucsc.edu/115/}. I've tried: ...
112 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: ...
371 views

### Compiling the VoigtDistribution PDF

According to List of compilable functions, Erf and Erfc are compilable functions. However, I want to make a compiled version ...
86 views

### Compile a function for Matlab

I need to export a pretty complicated function to Matlab. The function is not in symbolic form, but must be evaluated at a given x (because of some finite integral). I've tried with "ToMatlab" ...
178 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 ...
148 views

### Precompiling a Whittaker function

Is there a way to speed up the evaluation of special functions in Mathematica? I am particularly interested in the Whittaker W function. For instance, the following piece of code: ...
2k views

### Fastest way to measure Hamming distance of integers

I am looking for a fast and robust way to calculate the Hamming distance of integers. The Hamming distance of two integers is the number of matching bits in their binary representations. I expect that ...
87 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 ...
54 views

### FindMinimum with compiled function [duplicate]

I don't know how to fix this problem: ...
209 views

### Problem with machine number precision in compiled functions

When I compile a very big function and give it input the function returns error. I realized that this is because the value of the function becomes smaller than the smallest machine number. Is it ...
195 views

### CompiledFunction returns machine numbers smaller than $MinMachineNumber When thinking on the workaround for this LogLogPlot bug suggested by halirutan I noticed that CompiledFunction actually can ... 0answers 59 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, ... 0answers 168 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 ... 2answers 211 views ### Listable compiled function crashes the kernel with “no more memory available” Bug introduced in 9.0.0 and fixed in 10.3 I am trying to speed up a function that involves continued fractions. Since ContinuedFraction cannot be compiled and ... 4answers 364 views ### Speed up Schwarz-Christoffel mapping I would like to ask your advice how to speed up Contour and Parametric plots in the following example. Let as start by defining a function ... 1answer 567 views ### MinGW-64 and CompilationTarget -> “C”: can't make library I'm trying to set up my new Windows 8.1 tablet to compile Mathematica (9.0.1) functions to C, using the MinGW-64 compiler. I have it set up so that the following works: ... 0answers 29 views ### Unable to set up Mingw-64 compiler to get CompilationTarget-“C” working [duplicate] I am unable to set up the C compiler on my computer, thus can't not make the option CompilationTarget-"C" work in Compile. I am ... 1answer 71 views ### Fast 1D BinCounts Alternative I have lots of data which looks like this example: ... 2answers 231 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: ... 0answers 44 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 ... 1answer 123 views ### Why does this simple sum function fail to compile? Consider the following compiled function, which takes a$12 \times 5$array$x_{ij}$of real numbers and computes the triple sum $$\sum_{k=1}^5 \sum_{i=1}^{12} \sum_{j=i+1}^{12} x_{ik} x_{jk}.$$ ... 1answer 98 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 ... 1answer 168 views ### Compiled function crashes kernel when trying to list over different length arguments Bug introduced in 8.0 and fixed in 10.0 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 ... 1answer 67 views ### Closing over array values makes Compile choke with CompilationTarget -> “C” When I attempt to Compile a closure which contains an array of the appropriate type, it works just fine with ... 2answers 435 views ### Performance regression for Fold? I noticed an over 10x performance drop on Mathematica v9.0.1 (as Oleksandr R. commented, also v8) compared with v7.01 for this code: ... 1answer 158 views ### Compilation of Total with compensated summation I sometimes obtain an unexpected error when trying to call a compiled version of Total with compensated summation turned on. More specifically I define ... 1answer 109 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[] ... 0answers 114 views ### Linear interpolation over 2 variables [duplicate] 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 ... 1answer 61 views ### Module inside module in Compile How can I make compilation to go through with a module inside module? I tried this, failed, a few other ways failed too. ... 0answers 60 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 ... 1answer 111 views ### How to solve coupled complex-valued equations faster and get simplified solution I have six coupled equations. How to solve these equations symbolically faster in Mathematica. In these equations, variables p,q,x,y are ... 5answers 815 views ### Can (compiled) matrix permanent evaluation be further sped-up? Update III Mathematica 10.2.0 now ships with a predefined System`Permanent function, which the PermanentCode package ... 3answers 494 views ### Compiling LinearSolve[] or creating a compilable procedural version of it Earlier today I had a discussion with a representative at Premier Support about the 2 questions I've asked here over the past couple of days: Seeking strategies to deploy a function securely ... 1answer 608 views ### Use Compile to improve performance I've recently discovered Compile as a way to optimize my code. I wrote a program to learn something new about Compile. I have a ... 0answers 65 views ### Compile a listable function to be applied over list of lists [closed] Consider a simple function g[x_,y_,z_] := x + y + z; (indeed, any multivariate function g will illustrate the same thing). ... 1answer 81 views ### How to use Compile to generate an$n×n$array using$n$tensors with both Real and Integer element This is an extension of my earlier questions Faster use of Condition for a large array (see the example) and How to use Compile to generate an$n\times n$array using$n$vectors . In this case each ... 1answer 86 views ### Undeclared Identifier error in Compile I've been trying to compile a couple of functions in Mathematica, and I keep coming across an error that I do not know how to resolve. Consider the following function: ... 2answers 246 views ### How can I speed up my compiled RBF interpolating function? Overview I have a function that acts like the Interpolation on sparse$n$-dimensional data using a simple implementation of RBF interpolation method. I want my ... 1answer 122 views ### CCompile Problems Operating System: Windows 8.1 Mathematica: 8 In possession of: Visual Studio 2013 and 2015 Had to alter the visual studios driver file within CCompilerDriver application, add-on so that it found the ... 1answer 115 views ### Compiling If statement I'm tring to use Compile in the following code, but it gives me an error message that I don't understand: ... 2answers 198 views ### CompiledFunction crashes kernel Bug fixed in 10.0.0 This crashes my kernel ... 1answer 49 views ### Using Compiled Function in Implicit Region I am looking for a way to speed up code and thus would like to use a compiled function in an ImplicitRegion. Here is an example of a region that can be plotted ... 0answers 139 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: ... 1answer 111 views ### How to compile procedural program effectively Consider these four function in different form: ... 1answer 113 views ### How to use Compile to generate an$n\times n$array using$n\$ vectors

Let's consider the following: ...
141 views

### How to speed up an optimization with very long symbolic expressions?

I have 8 very long symbolic expressions (each having around 200,000 summands) - Simplify will run forever, so that is unfortunately not an option. Each of those ...
167 views

### Use a part specification as the argument to a compiled function

I have some code that needs to generate a large matrix based on some complicated combinations of smaller matrix elements. I find that if I write a function for the element of the larger matrix, and ...
137 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 ...