Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
9 votes
2 answers
126 views

How can I return an empty list from FunctionCompile?

The following code is for solving a linear congruence of the form $ax=b \; (\mathrm{mod}\ m)$ using FunctionCompile. ...
ngc5139's user avatar
  • 307
0 votes
0 answers
63 views

Using compile with indexed variables

I have the following piece of code which I made faster by using compile. I make the following definitions ...
QFTheorist's user avatar
1 vote
1 answer
90 views

Why is this function not compilable?

Consider some functions ...
John Taylor's user avatar
  • 5,963
3 votes
1 answer
114 views

Can I efficiently use a compiled function as an input to another compiled function?

I have a compiled function(such as $f\left(z,c\right)=z^2+c$) which will get replaced by different equations as the code runs. I'm using this compiled function(#1) inside another compiled function(#2)....
Laff70's user avatar
  • 171
8 votes
1 answer
144 views

What Does Compile`SetIterate Do?

The list of compilable functions (given by Compile`CompilerFunctions[] // Sort) shows one of the more interesting- and core-sounding functions: ...
Just Some Old Man's user avatar
1 vote
1 answer
107 views

Mysterious RegionDistanceFunction::regp message

Bug introduced in 12.3.1 or earlier and persisting through 13.1.0 [CASE:4853257] I encountered a strange problem with RegionDistanceFunction. Consider this list of ...
Alexey Popkov's user avatar
1 vote
2 answers
64 views

Compile function with only some variables [closed]

I made the simple example below for explaining the problem. How can I compile only some variables? For example, in the example only a and ...
emnha's user avatar
  • 2,111
4 votes
2 answers
83 views

Functions within modules within Compile

I've noticed that if I try to define a Function within a Module within Compile, I get errors ...
Sean's user avatar
  • 645
1 vote
1 answer
66 views

How to collect results from compiled function in ParallelEvaluate?

I am using Mathematica 12.x and have a compiled function, returning many things. I would like to run several instances of this compiled function, one for each core of my CPU, and then collect all of ...
HaloArchive's user avatar
0 votes
1 answer
77 views

Compiling RiccatiSolve LQRegulator gains

Given some specific matricies, numA, numB, numP, q and r to calculate LQR gains, one can use simply LQRegulatorGains or solve the same via ...
DrMrstheMonarch's user avatar
2 votes
3 answers
93 views

Strange Behavior of Compile[] inside With[]

Consider, in the examples below, the difference between defining $n$ as a global variable or as an argument to function comp[], which includes a compiled function ...
Just Some Old Man's user avatar
2 votes
1 answer
69 views

why this simple code is not giving the right answer under Compile

I have two sets of inputs that are to be fed to a simple function. The inputs are essentially a set of triangles and the normal for each triangle. The function will compute the gradient about the ...
Ali Hashmi's user avatar
  • 9,060
2 votes
1 answer
159 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 ...
Rick's user avatar
  • 21
2 votes
1 answer
138 views

Position with Compile is acting slower than without

For a big matrix 5000 x 5000 or list2 i am trying to get positions of all entries Except[1.0]. I am using ...
Ali Hashmi's user avatar
  • 9,060
0 votes
1 answer
340 views

How do Compile and Module work in a code?

I am trying to understand the following code in this answer regarding Möbius transformation: ...
user avatar
3 votes
2 answers
385 views

Sum acting weird for large values [duplicate]

I have the following functions: T = Compile[{n}, Boole[Sum[RandomReal[]^2, {n}] <= 1]]; Monte[d_, n_] := Sum[T[d], {n}]/n*2^d T is a function that generates a ...
Alecto's user avatar
  • 864
0 votes
0 answers
366 views

Compiling matrix multiplication using a list of matrices

I'm trying to create compiled function which computes a list of Gamma matrices named GammaM and multiply them within the compiled code. ...
MvP's user avatar
  • 265
2 votes
1 answer
235 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 ...
Steven Thiel's user avatar
3 votes
0 answers
541 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 ...
user13999's user avatar
  • 907
183 votes
8 answers
22k views

List of compilable functions

Is there somewhere a list on the functions that Compile can compile, or the cases in which a particular function can be compiled that I haven't found? I'd be glad ...
Rojo's user avatar
  • 42.8k