All Questions

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

Evaluation control inside Compile

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

Can we compile this function/distribution?

I would like to compile this function to make it faster: ...
2
votes
1answer
90 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 ...
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 ...
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
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 "...
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 ...
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
72 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: ...
2
votes
0answers
90 views

How to speed up multiple calls of NonlinearModelFit?

I'm trying to do an insane amount of non-linear fits to large amounts of data sets. However, I found that the NonlinearModelFit is horribly slow. Here's the setup: ...
6
votes
1answer
200 views

How to speed up evaluation of expression (multiple variables) to gain speed? Compile?

I obtained some long expression and need to use them with a lot of different parameters inside a simulation. However, evaluation of the expressions is pretty slow, so that I would like to speed it up. ...
4
votes
1answer
84 views

Efficient compilation of a list of functions

Let's say that we have at our disposal nbfunc = 4; functions, whose exact expressions are gathered in the list ...
2
votes
0answers
48 views

Compile with “Listable” only on one argument

I would like to write a Compiled function which is listable only in the first argument, because this allow fast and easy parallelization. How is it possible to do it? In the following way it does not ...
3
votes
1answer
65 views

How can Distribution fitting be sped up?

The first line generates 1050 data points to fit. The second line fits this data to the same distribution. This takes about 100ms on my computer. Doing this with ...
0
votes
0answers
167 views

how to speed up this function?

in this code cumavg1,cumstd1,giuper1,gilower1 are compiled. however, i dont know how to compile ei and fi to further speed up the calculation. any help will be appreciated. ...
7
votes
2answers
2k views

Can this code be changed to run faster?

I've worked for several days trying to get this code to run faster. The imported data is 15MB. ...
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. ...
10
votes
3answers
290 views

Mod slow in CompiledFunction

I've been playing with a little compiled Ising model implementation. It's brutally slow. Decomposing things I've found that the primary culprit appears to be Mod. ...
0
votes
1answer
77 views

How to boost the performance of a function that approximates a 3D object

I have defined a function $f_{a}(\boldsymbol{r})$ that gives a finite discrete approximation of a continuous function $f(\boldsymbol{r})$ that represents a 3D object. Here, the object is a sphere of ...
0
votes
1answer
60 views

Compilable table of Matrix diagonals function

1, I am trying to make Compilable function which takes Matrix of zeroes and ones f.e: ...
3
votes
2answers
103 views

Avoid hardcoding of variables for Compile by using a list

I want to automatically Compile an expression in between a routine of certain analytical manipulations. The number of arguments for the function may change for ...
0
votes
0answers
68 views

Is it possible to compile this code?

I'm not really familiar with the Compile function at Mathematica yet, but I know that it can, in some cases, be faster than using a non-compiled version of a code. I've been giving some shots in ...
3
votes
1answer
160 views

Debug numerical error inside CompiledFunction

I want to speed up evaluation time of a long expression (a function of a single parameter t). To do so, I thought about using ...
0
votes
0answers
49 views

Compile a precomputed list-type expression

I precompute an expression which takes pretty long to evaluate (i.e. for my real problem tmp[2] takes quite long) and I want to see if runtime can be improved using ...
2
votes
3answers
320 views

Random Geometric Graphs, but fast

I am optimising the random geometric graph generation ideas in this post. I need to generate a large number of random geometric graphs with probabilistic connectivity (soft random geometric graphs), ...
4
votes
2answers
453 views

Compile a program with Fold function

I have the following small program: ...
5
votes
4answers
391 views

Findroot with a precompiled function with parameters

If I want to precompile a function that I intend to put into FindRoot many times, I could do it like this: ...
5
votes
2answers
185 views

Making calculation of correlation dimension faster

I am trying to make my calculation faster. I was hoping, when I compiled it, it would work much faster, but in the end its even slower. I don't know if I am using ...
4
votes
2answers
201 views

Numerical Join of two sets of vectors ignoring repeats

I have two sets of numerical vectors which can be either Real or Complex and I want to combine them together, ignoring repeats. ...
5
votes
2answers
339 views

Using Findroot with Precompiled Function

I am writing a Monte Carlo algorithm to solve some algebraic equations. To do this I need to evaluate FindRoot many times on the same function. Following from F'x's answer to Expression evaluation ...
1
vote
1answer
78 views

Speeding up computation of a sequence

I am simulating the dynamics of a spring mass system impact an obstacle. I will not go into the details of the numerical scheme, but here are the general parameters and functions: ...
13
votes
4answers
639 views

Implementing a compilable Faddeeva function of complex argument

For those, who are looking at Halirutan's answer and thinking "gee, I wish I was that good at LibraryLink, then I could really speed up my code!" I leave here the ...
1
vote
1answer
77 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 ...
3
votes
2answers
141 views

Can I compile my function?

I'm trying to do some time-consuming simulations but I have no idea how to optimize this. ...
5
votes
2answers
108 views

Optimizing user defined graphicQ, test of graphicness of a sequence

A sequence of non-negative integers is graphic if it is the degree sequence of some simple graph. Graph realization problem is the decision problem where it is asked whether a given sequence is ...
3
votes
1answer
98 views

What is the most effective way to reassign values in an array based on their positions

I have to reassign values in a big array many times and it turned out to be the most time consuming in my program. The best way I could figure out is this ...
6
votes
1answer
204 views

Why is Compile + RandomReal faster than random real?

In the process of playing around with Compile, I discovered something surprising. RandomReal[{-1, 1}, 3] is a lot slower than <...
0
votes
0answers
108 views

Performance tuning with memoisation, compilation and vectorization - further possibilities?

In order to tune the performance of noticeably slow code of mine, I had a look at many different excellent posts on this topic here on M.SE, e.g. here to name the most interesting one. Now I ask ...
30
votes
2answers
590 views

Why is CompilationTarget -> C slower than directly writing with C?

Probably a hard question, but I think it's better to cry out loud. I've hesitated for a while about whether I should post this in StackOverflow with a c tag or not,...
0
votes
0answers
102 views

Compile function for NMinimize

I have a the following script, which essentially minimizes the function $h$ with respect to all the variables $a[\alpha][s][j][n]$, where $\alpha,s\in\lbrace0,1\rbrace$, $j \in \lbrace ,\ldots,\text{...
5
votes
1answer
170 views

How to avoid AppendTo when computing similarities

I need to make the calculation of the HammingDistance for strings faster. The background is that I want to be able to compare the similarity of images of a textual ...
3
votes
0answers
95 views

How to deal with “Compile::cset” in Compile

When compiling below code Compile[{{data, _Integer, 2}}, Fold[Flatten /@ Flatten[Outer[List, ##, 1], 1] &, data]] I encountered error messages Compile::...
2
votes
0answers
155 views

How to use Compile? Bivariate Gibbs Sampler

I am trying to use compile to speed up my Gibbs sampler. I know I can use Reap and Sow to speed up tremendously. I have a more complicated Bayesian posterior that I want to speed up with compile so I ...
2
votes
1answer
229 views

Compiling in mathematica

I'm trying to compile what I think is a pretty simple function that does matrix multilplications in a loop (see below). But Mathematica issues the message: Could not complete external evaluation ...
3
votes
1answer
135 views

Table with programmatically specified number of iterators in Compile

Compare two ways of computing a table of values of a multivariable Gaussian: ...
7
votes
1answer
289 views

How to boost the performance of my own BSplineFunction

In my CAGD package, I implemented a CAGDBSplineFunction[] like built-in BSplineFunction[]. ...
1
vote
0answers
132 views

How to speedup Plot3D with precompiled argument

I have a huge problem with my code: I estimate it to take hours to run. The scheme of the code is the following (I left the steps the same, but took much simpler functions): ...
0
votes
0answers
362 views

How to compile code that involve sparse array?

I have the following code ...
4
votes
1answer
196 views

Why does Compile not make my function faster?

I need to speed up a large program that repeatedly calls the module below (I've not trimmed the code for this question to ensure there is enough calculation to show a speed improvement.) The obvious ...