7 votes

How to use Compile to optimize the performance of a function calculating the distance between two points?

...
Karl's user avatar
  • 211
7 votes

Is there a faster way to compose a large number of random Gaussians?

Basically the idea is to draw in vector form, then exploit FrontEnd's ability to Rasterize the result. First we make the base primitive corresponding to a "...
Silvia's user avatar
  • 27.4k
7 votes

Is there a faster way to compose a large number of random Gaussians?

You use MapThread with a CompiledFunction. But CompiledFunctions have their own threading ...
Henrik Schumacher's user avatar
6 votes

How to use Compile to optimize the performance of a function calculating the distance between two points?

Karl's answer is perfect as it is. If you know for sure that your input vectors have at least length 3, then it is safe to deactivate the bound checks that Mathematica writes into the C code. This can ...
Henrik Schumacher's user avatar
5 votes

Is there a faster way to compose a large number of random Gaussians?

The 3D Case takes just a few seconds using OpenCL. It was a real pain getting OpenCLLink to work. I also improved the alpha blending. ...
flinty's user avatar
  • 23.7k
4 votes

How to use Compile to optimize the performance of a function calculating the distance between two points?

[Answer to a different question...] The compiled methods are fine if, for each point in one set, you only want to check distances to a small number of points in the other set (the examples have "...
Daniel Lichtblau's user avatar
4 votes

How to use Compile to optimize the performance of a function calculating the distance between two points?

What follows is a more detailed demonstration of Karl's answer on this page. This demonstrates the performance improvement (amazing, in my opinion) offered by ...
Andrew's user avatar
  • 10.4k
1 vote

How to improve the speed of tables in Mathematica?

At least the timing can be reduced by 1/5 by using functions instead of replacments inside the Table fff[t_, x_, v1_, v2_] = ff ...
Roland F's user avatar
  • 2,779
1 vote

Optimization of a Markov сhain with symbolic transition rate

I don't know what you want to do honestly. if you want everything to be symbolic,how about using characteristic function? Consider a conditional random walk. Let's say that if the value of i is ...
Xminer's user avatar
  • 1,215
1 vote

Grouping consecutive elements at specified positions

Question 1: ...
eldo's user avatar
  • 47.5k
1 vote

Combining list elements

...
eldo's user avatar
  • 47.5k
1 vote

Subtracting second columns of two matrices

...
eldo's user avatar
  • 47.5k
1 vote

How to find all the positions of max value of a list efficiently?

Using PositionIndex: (introduced 9th July 2014) ...
Syed's user avatar
  • 41.4k
1 vote

How to find all the positions of max value of a list efficiently?

Since V 13.2 we have PositionLargest and PositionSmallest ...
eldo's user avatar
  • 47.5k
1 vote

Better way to test that a matrix is upper-triangular?

Since V 12.0 we have UpperTriangularMatrixQ: ...
eldo's user avatar
  • 47.5k
1 vote

Counting the population of integers

This has a lot of answers already, but here's an obvious (to me) solution that hasn't been mentioned: ...
Sjoerd Smit's user avatar
  • 21.9k
1 vote

Counting the population of integers

...
eldo's user avatar
  • 47.5k

Only top scored, non community-wiki answers of a minimum length are eligible