Questions tagged [function-compile]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
55 views

FunctionCompile get IR source code [closed]

A new fancy option to compile WL's function using LLVM is amazing. Is there any way to get the IR's (intermediate representation) representation of it? According to specification there are two forms ...
Kirill Vasin's user avatar
  • 1,177
0 votes
0 answers
31 views

Defining a function for FunctionCompile[]

Lets say that I have the definition EQN4 that is determined from some calculation. If I run it in a cell, I get the following output: ...
Bajablaster's user avatar
21 votes
1 answer
553 views

Compile vs FunctionCompile

I wanted to look at the pros & cons of Compile & FunctionCompile. This code below is from Neat Examples in FunctionCompile documentation. ...
Ted Ersek's user avatar
  • 884
0 votes
0 answers
48 views

Are you surprised with the apparent inconsistency in what this CompiledCodeFunction returns?

I am using Mathematica 12.2 with MacOS, and I do this: ...
Ted Ersek's user avatar
  • 884
2 votes
0 answers
40 views

How can I know what prevents efficient lower level code when using FunctionCompile?

When using the old Compile, I can use CompilePrint and ensure the resulting CompiledFunction doesn't use MainEvaluate. If MainEvaluate isn't used, the CompiledFunction is efficient. How do we know if ...
Ted Ersek's user avatar
  • 884
0 votes
1 answer
149 views

How to compile this function to speed up operation?

...
miss's user avatar
  • 449
1 vote
1 answer
81 views

LMDB Library cannot be loaded by `LibraryLoad`, how to compile properly

I cloned LMDB* from https://github.com/LMDB/lmdb and compiled on a Mac M1 with make -e clean liblmdb.so CC="cc -target aarch64-macos-none" which produced ...
Adam's user avatar
  • 3,897
2 votes
0 answers
72 views

Large Structured Programming with Compile

Is it possible or wise to build a large program structure with only Compile? With FunctionCompile it is possible to create ...
Michael Haring's user avatar
2 votes
0 answers
99 views

How can I compare two ByteArrays inside FunctionCompile in 13.3

I need a compiled function that takes an array of bytes as input and in the process compares parts of that array. It's really just looking for the occurrence of one array in another. It works if you ...
Kirill Belov's user avatar
3 votes
1 answer
101 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
1 vote
0 answers
65 views

How to use FunctionCompile and Compile as external definition?

Let's consider the following functions (in $Version: 12.3.0 for Linux x86 (64-bit) (May 10, 2021)) ...
csk 7's user avatar
  • 403
11 votes
1 answer
1k views

Why CompilationTarget->"C" doesn't improve computation time

I wrote a simple code to test the computation time under CompilationTarget->"C". I get barely any improvement on the computation time from ...
csk 7's user avatar
  • 403
1 vote
2 answers
120 views

How to use global variables in FunctionCompile?

In FunctionCompile, system does not recognize external functions and external global variables by default. But we can use ...
swish47's user avatar
  • 133
0 votes
0 answers
72 views

Sharing state among FunctionCompile'd functions

Understanding that the new Wolfram compiler remains a work in progress: Global variables apparently aren't accessible from FunctionCompile'd functions. However, ...
RRas's user avatar
  • 538
1 vote
0 answers
39 views

How use LibraryFunctionDeclaration to call the function with DataStore parameter?

I have a CMakeProject1.dll produced by this code: ...
yode's user avatar
  • 26.3k
2 votes
0 answers
117 views

Problem with "FunctionCompile"

MMA version 13.1 Windows 10 Can someone explain why the following compiles: f = Function[{}, Table[i, {i, 2}]]; FunctionCompile[f] But if we have 2 iterators it ...
Daniel Huber's user avatar
  • 47.2k
4 votes
2 answers
207 views

How to get a MTensor variable by a vector object

librarylink have a dirty signature such as: EXTERN_C DLLEXPORT int fun(WolframLibraryData libData,mint Argc, MArgument* Args, MArgument Res) But when we are in ...
yode's user avatar
  • 26.3k
9 votes
1 answer
310 views

How to restore the compile function from FunctionCompileExportByteArray

We can compile a function into a ByteArray object: ...
yode's user avatar
  • 26.3k
5 votes
2 answers
533 views

Why the Debug .dll is work normall but the Release .dll is crash in librarylink?

The Catenate is very slow in FunctionCompile. So I want to use the librarylink to make a .dll...
yode's user avatar
  • 26.3k
23 votes
2 answers
601 views

How to call the C++ by the new LibraryFunctionDeclaration?

When we arrive at V13.1, we have a great LibraryFunctionDeclaration now, which can call C function in MMA as this article: ...
yode's user avatar
  • 26.3k
2 votes
0 answers
62 views

Using FunctionCompile to emulate DistanceMatrix with my own DistanceFunction

I'd like to create a distance matrix with an expensive distance function. To explore how to do this for a simpler case, consider these three ways of creating a Euclidean distance matrix: Using a ...
Craig Carter's user avatar
  • 3,968
6 votes
1 answer
247 views

FunctionCompiling lists of things

I have a compiled function that works on a list of some atomic type e.g. strings, but also want it to work on lists of others (e.g. integers, reals, symbols, etc). Moreover, nothing in the code has to ...
user5601's user avatar
  • 3,581
5 votes
3 answers
250 views

Implementing fast linear search for perfect vertical image alignment

After experimenting with image alignment aprroaches presented here and here and some other approaches involving ImageDistance and ...
Alexey Popkov's user avatar
3 votes
1 answer
115 views

How do I use a FunctionCompile(d) function in FindMInimum

Suppose I would like to speed up the function in FindMinimum[function[variables],startingPoint] by compiling function I've constructed a minimal working example to describe what I would like to do. ...
Craig Carter's user avatar
  • 3,968
11 votes
1 answer
468 views

Speediest Julia Set "By Hand"

While being aware of the built-in command, I would like to show my students how the Julia set is actually generated. The code I came up with is slow, even though I am quite happy with the picture it ...
Matthias's user avatar
  • 343
1 vote
0 answers
86 views

FunctionCompile Type Errors

This function works uncompiled: Function[{n, m, k}, ParallelSum[ Length[Permutations[i]], {i, IntegerPartitions[m, {n}, Range[0, k]]} ]] but compiling with <...
user avatar
4 votes
0 answers
98 views

How to efficiently build a large sparse matrix and overloading a compiled function?

I would like to construct a large sparse matrix folding from rank-4 tensor given by the following: $\mathcal{L}_{1L}^{00}(i,j)=\mathcal{L}_{1L}^{00}(m_1,m_2;M_1,M_2)$ The indices of matrix $(i,j)$ are ...
Bob Lin's user avatar
  • 445
0 votes
0 answers
149 views

How to calculate this summation numerically?

I want to calculate this summation numerically: $\sum_{n=1}^{10^{10}}\frac{1}{n^3\sin(n)^2}$ First I try NSum[1/(n^3 Sin[n]^2), {n, 1, 10^10}] however it gives a ...
Jie Zhu's user avatar
  • 513
16 votes
0 answers
381 views

FunctionCompile examples for Computer Vision

I'm looking for some good examples of FunctionCompile applied to image processing code since there doesn't seem to be anything on this in the documentation. So here's a first attempt at a hello world ...
M.R.'s user avatar
  • 31.2k
12 votes
2 answers
389 views

Using DataStructures in FunctionCompile

This is a follow up to this StackExchange question I am trying to do the equivalent of Select on a "FixedArray" data structure. Here is what I have tried so far: ...
Craig Carter's user avatar
  • 3,968
11 votes
0 answers
220 views

How to use Bags in FunctionCompile?

I was reading this question and it wanted to know how to FunctionCompile this: ...
M.R.'s user avatar
  • 31.2k