Tagged Questions
13
votes
2answers
236 views
Fastest way to measure Hamming distance of integers
I am looking for a fast and robust way to calculate the Hamming distance of integers. The Hamming distance of two integers is the number of matching bits in their binary representations. I expect that ...
13
votes
1answer
178 views
Is the sharing of variables in Module/Block within Compile documented behavior?
Today I noticed something, I think for the first time.
When used inside Compile variable values within Module (and ...
4
votes
4answers
228 views
How to compile the code for generate Pythagorean_triple?
I am finding Pythagorean_triple, it worked slowly. I tried to compile, but it gives some warnings.
I also use "Case" or "Do" ,both of them failed.I'm sure my CCompiler has been set correctly.
How can ...
3
votes
2answers
402 views
Optimize inner loops
I'm Mathematica newbie so please be gentle :)
I have this, heavily non-optimized part of code, which I would like to speed up. I have put all matrices to be RandomReal, but in my code they take ...
2
votes
0answers
116 views
10
votes
1answer
220 views
Using Apply inside Compile
In this great answer a compiled version of the Nelder-Mead algorithm is presented.
Since it works on arbitrary dimensions (i.e. arbitrary number of arguments), it has to use apply on the objective ...
7
votes
3answers
325 views
Threading a compiled function over multiple arguments of different lengths
I am interested in threading a compiled function over multiple argument lists of different lengths.
I will explain this in two steps:
Suppose f is some function. Then one can define another ...