The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [compile]

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

Filter by
Sorted by
Tagged with
2
votes
0answers
36 views

Speeding up the process of NDSolve[] when a user-defined function is involved?

I am trying to tackle a (1+4 dimensional PDE) model at which the solution of the first PDE (with some interpolations and changing the domain) would be used in the second PDE. In fact, I must choose ...
0
votes
0answers
42 views

Evaluation control inside Compile

I have the following function ...
2
votes
1answer
43 views

How use the same Compile function with different equations

Say I have 2 equations that take the same parameters and variables that I want to evaluate numerically in compiled code ...
0
votes
1answer
64 views

How do I skip to the end of a loop when a compiled function yields an error?

This is something of a follow-up to my question In an iterative process, how does one simply bypass a step producing an error? which I have been so far (thick-headedly) been unsuccessful in ...
0
votes
2answers
77 views

In an iterative process, how does one simply bypass a step producing an error? [closed]

This is undoubtedly rather elementary, but the remedy escapes me presently (and does not, as far as I can see, readily appear in Help). I'm engaged in an iterative process with several computations ...
2
votes
2answers
35 views

Plot[Evaluate[compiled functions… causes problems

I'm sure there is an easy solution to this, but I have beaten my head against a wall for a couple of days, so I hope someone can help. I have compiled functions. For a minimal example let's take: <...
0
votes
0answers
29 views

Using Compile, after instaling MinGW

I want to use Compile. I got the following error message: ...
4
votes
1answer
57 views

d-dimensional compiled function in NDSolve

Based on this answer, I understand how to use a one dimensional compiled function in NDSolve. Mathematica NDSolve and 'Compile'? I'd like to be able to use a d-dimensional compiled function <...
2
votes
1answer
90 views

Can we compile this function/distribution?

I would like to compile this function to make it faster: ...
1
vote
0answers
134 views

Can I use the Gwnum library to accelerate the multiplication in Mathematica?

Is it possible to use Gwnum library to accelerate the multiplication in Mathematica?
1
vote
1answer
692 views

Compile error: clang: error: linker command failed with exit code 1

After not using Mathematica 10.0.2.0 for a few months (I think since december 2018) on my MacBook Pro from 2013 (now with macOS Mojave 10.14.5) I am suddenly facing issues with ...
2
votes
1answer
90 views
0
votes
0answers
23 views

Optimizing and Parallel Computing for Large Dyadic Intervals

I need help with the efficiency of my code i.e. less time so I can compute for large range of values. My function n[x] takes in a number x and outputs the ...
10
votes
1answer
78 views

WVM hangs or crashes on empty array when compiled Listable

Bug introduced in 12.0 and persisting through 12.0 or later When I run the following code, the kernel hangs indefinitely: ...
0
votes
1answer
27 views

Replacement inside NIntegrate

I'm computing rather complicated expressions using NIntegrate, and for that, my integrand is created as some compiled function (to speed up evaluation). ...
4
votes
0answers
125 views

Speed improvements and confusion for MapThread and Dot

I have a question / confusion over improving the speed of MapThread[Dot,...] for lists of tensors. My problem involves taking two lists of tensors and then ...
0
votes
0answers
32 views

Specify type in output of a compiled function

I want to prepend an array with a position index in the first column using a compiled function. For some reason, the position index is always returned as a float and not as an integer. How can I ...
2
votes
1answer
43 views

Gyrating particle transmission through rectangle: NIntegrate or something faster?

I need a function that tells me, what transmission a gyrating particle has through a rectangular aperture if you consider all phase angles. So for a specific guiding center position and gyration ...
4
votes
2answers
93 views

Modified FrontEnd to parse & highlight function definitions for compilability?

I suspect this would require advanced MMA skills, but it would be very useful if one could modify the front end so that any MMA defined function calls in a Compile[] could be flagged if they are not ...
0
votes
0answers
56 views

CompiledFunction::ctfa - Argument should be a rank 4 tensor of machine-size real number

Dear Mathematica community, I got the following error line: CompiledFunction::ctfa "Argument {<<1>>} at position 1 should be a rank 4 tensor of machine-size real number" This is my function:...
1
vote
1answer
79 views

How to compile properly for performance tuning

I have a question about how to compile functions properly for performance tuning. Currently, I am trying to solve an eigenvalue problem of a large matrix. Initially I just used the conventional ...
5
votes
1answer
48 views

RandomPoint returns compiler errors on RegionIntersection of two Meshs?

Consider the intersection of two ConvexHullMesh's, m1 and m2. ...
4
votes
0answers
91 views

How to compile effectively with recent MMA? Global variables in C code, compilation of C code

I have read the generously comprehensive answers by @leonidshifrin and @xzczd to the question How to compile effectively but more than seven years have now passed, and whilst I am sure much remains ...
16
votes
2answers
537 views

Using Boost with CreateLibrary

I was looking at the answer of Leonid of Faster alternatives for DayOfWeek and wanted to see how hard it would be to do something similar in C++ using an external library like Boost. I tried to ...
1
vote
0answers
74 views

Running a C compiler on Windows Subsystem for LInux [closed]

I want to use the compile-to-C functionality of Mathematica. Has anyone gotten the C compiler driver to recognize a C compiler (for instance gcc) installed on a Windows Subsystem for Linux? I am ...
2
votes
0answers
80 views

Strategies for using mathematica compiled code on a website?

I have developed a chaos detection algorithm which is already used as a compiled (target C) function within Mathematica. The development has been done under Win 10 64-bit with MMA 11.0.1 and the ...
9
votes
1answer
214 views

Question on FunctionCompile

So far, I have mixed feelings about the new compiler in Mathematica 12. Sometimes my results are a little bit faster, sometimes they are considerable slower than those obtained with the old compiler ...
14
votes
1answer
3k 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 ...
2
votes
2answers
64 views

Changeable global variables in compile statement

If a global variable is changed before each call of the function then answer is not changed accordingly. Please see a toy example: ...
0
votes
0answers
57 views

How to make a compiled version of a function?

I'm trying to make a compiled version of this function ...
6
votes
0answers
140 views

Possible Compile bug

Bug introduced in 11.3 or earlier The program: ...
12
votes
2answers
360 views

Has compilation of big programs become excessively sluggish in v 10.4?

Bug introduced in 10.4 and fixed in 11.0 After updating to 10.4, many of my heavily numerical functions defined by Compile takes a huge amount of time to compile ...
23
votes
0answers
401 views

Compile not correctly initializing a variable defined inside Module

Bug introduced in 8.0, fixed in 10.4, intentionally reintroduced in 11.0 and persisting through 12.0. In the following example, inside the minimumX's ...
3
votes
0answers
143 views

How to get the executable out of a compiled function and run it in cmd

Can someone please guide how to run the function compiled by Wolfram Language in cmd independent of the kernel. It seems to export it into ...
5
votes
0answers
117 views

Optimize Use of PeakDetect in Mathematica

I am quite new to Mathematica and I am looking for some advice in order to improve and optimize my code. Here is what I am trying to do: Open a stream Read the stream line by line and store it in "...
61
votes
4answers
4k views

Speeding up this fractal-generating code

I used the code below (which is a sample from this gist containing more similar code) in my answer to my own question about Mandelbrot-like sets for functions other than the simple quadratic on Math....
0
votes
1answer
80 views

How can I use Compile to implement recurrence?

I am trying to make the code for the following recurrence. Here wjoin[[i]] is used for calling values from a data set and a is a ...
3
votes
0answers
73 views

What are the recommended best practices for and common pitfalls of using Compile? [duplicate]

As evidenced in my last question there is much I do not know about how to write compilable functions. The basics are clear: one must load the appropriate packages ...
1
vote
1answer
81 views

How to deal with this error in Compiled Function?

...
2
votes
1answer
101 views

Why won't nominally compilable function compile? (err Compile::cpintlt)

Context: I have millisecond timestamped sample data that I want to convert to a uniformly sampled series. This I do by padding each interval with repeated values (pbp ~ 'pad by position'}. The ...
2
votes
1answer
67 views

Return multiple results from compiled function [duplicate]

I wrote a function with Compile that produces a large array of data and later does some computation on it. Now, I want to return from the compiled function not only ...
0
votes
0answers
88 views

Compile a Module

Itried first to compile this Module ...
1
vote
1answer
52 views

Pick inside Compile

I want to compile this function: ...
6
votes
4answers
225 views

Numerical contour plot of compiled function

I have come across a problem in Mathematica when I have tried to plot the contours of a compiled function. ...
0
votes
0answers
59 views

Create Compiled Function - Matrix Initialization

I am attempting to compile the following function: But I receive the following error messages: How should I initialize the matrix Vw to enable the assignment to Vw[[1,1]]? ...
5
votes
1answer
165 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. ...
10
votes
2answers
159 views

How to avoid “CopyTensor” in compile function with external call?

I am writing a complicated compile function. To make it clear, I want to separate it into two smaller compile functions with one calling another. As you can see the example below, the ...
7
votes
1answer
137 views

Efficiency in calculation on graphs: Compile?

Basic Question I have a looping calculation that I need to perform on some large lists a very large number of times, and as I have written the functions the computational speed is prohibitively slow. ...
0
votes
1answer
70 views

What is the best build-in function to pick or select given element in a huge list

im looking for a best and efficient function works like a search engine it takes for example m=5+6I ,then it goes searching in the list V={1,1+I,2+3I,...} until catch it . My Dr said to use "Select[]"...
7
votes
0answers
66 views

Substitute for Association inside Compile?

Associations are not compilable, so I’m looking for a workaround to this. That is, I need a mutable hashtable-like data structure with fast key value lookups ...