Questions tagged [compile]

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

Filter by
Sorted by
Tagged with
4
votes
1answer
45 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
80 views

Can we compile this function/distribution?

I would like to compile this function to make it faster: ...
1
vote
0answers
118 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
133 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
84 views

How to compile or speed up a function with eigensystem?

I have defined two functions as following: ...
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
75 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
25 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
123 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
24 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
41 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 ...
0
votes
0answers
34 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
77 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
87 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 ...
1
vote
0answers
71 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
79 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
191 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 ...
0
votes
0answers
55 views

How to make a compiled version of a function?

I'm trying to make a compiled version of this function ...
2
votes
2answers
62 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: ...
3
votes
0answers
127 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
111 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 "...
5
votes
0answers
135 views

Possible Compile bug

Bug introduced in 11.3 or earlier The program: ...
0
votes
1answer
76 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 ...
2
votes
1answer
100 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
58 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
87 views

Compile a Module

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

Pick inside Compile

I want to compile this function: ...
6
votes
4answers
207 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]]? ...
7
votes
0answers
63 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 ...
1
vote
1answer
33 views

NIntegrate fails with functions that have (necessarily) numeric lists as arguments

I'm not able to NIntegrate a function that has a numeric list as an argument. My original problem involves a compiled function, but a MWE is the following: ...
7
votes
3answers
129 views

CompiledFunction showing its contents

CompiledFunctions usually appear very compactly, for instance: ...
1
vote
1answer
78 views

How to deal with this error in Compiled Function?

...
0
votes
1answer
98 views

Create Compiled Function

I am trying to create a compiled version of this function: ...
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[]"...
2
votes
1answer
65 views

Recursive function to compiled version

I have looked up some articles about the compiling recursive functions. I know usually there is no general solution to these kinds of questions. And my case is a little bit different (or more ...
6
votes
1answer
112 views

Creating a multidimensional array with Compile

For one of my programs I need to preallocate a multidimensional list/array. For performance reasons I want to do this within Compile and compile my program to C-...
5
votes
1answer
148 views

Compile `DeleteCases`

How is the function DeleteCases compilable if Compile does not support patterns? My question refers to this thread here where I ...
1
vote
0answers
57 views

Nested sums in `Compile` [duplicate]

in my code I face the necessity of using nested sums within Compile[]. Unfortunately, nested sums cause a call to MainEvaluate ...
5
votes
0answers
80 views

Random number generation within Compile and Parallelization->True

According to this thread RandomChoice is a compilable function. I use it to generate random numbers in a compiled function with parallelization enabled. I wrote ...
1
vote
1answer
127 views

How to compile with list?

I try to compile this code, but always failed, could anybody guide me? ...
1
vote
1answer
67 views

Compile errors after reloading of laptop contents after challenging MacOS Mojave installation

I tried (foolhardily, it appears) installing macOS Mojave Version10.4 on my MacBookAir, but encountered major problems--that seemed to have been (finally) fixed after a reinstallation and reloading of ...
0
votes
0answers
41 views

Compile elementary functions

I am looking to compile some elementary functions to pseudo C-code by using Mathematica's built-in function Compile as efficiently as possible. I am interested ...
2
votes
1answer
43 views

Indexed variables in compile

In this contribution Leonid Shifrin says that You can not really use indexed variables in Compile, although it may appear that you can. This sounds ambiguous to me. Is it possible or is it not ...
2
votes
1answer
57 views

Compile command does not succeed with list input with Parallelization->True

J. M. suggested that I pose the following as a question, a matter arising in relation to the function probit: ...
0
votes
0answers
62 views

compiling matrix row assignment

I have this relatively simple code, generated with another Mathematica code (this is just an example): (edit: see below for simpler version) ...
3
votes
1answer
64 views

SystemException[“MemoryAllocationFailure”] with compile and speed issues

I am trying to run a code that gives out a matrix but, I seem to encounter some memory issues while trying to run it. The code is: ...
3
votes
1answer
39 views

How to avoid “CopyTensor” in compile function with external call: the other case?

I was very interested in the answer of How to avoid “CopyTensor” in compile function with external call? and tried it on my own example below. And it does not work. Just curious why? ...