Skip to main content

All Questions

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

Question About Possible Ver 14.0 Bug

All: I'm running the following code. It's coming up with a persistent bug that seems to be related to the graph and processing the information; see image. Any advice? This code works fine with Ver 13....
user42700's user avatar
  • 1,837
2 votes
0 answers
94 views

How to push the performance of this compiled function

I have the function optvals solving for two variables. For the given example of variables, I need the program to run atmost in a millisecond. The main part of the ...
Dotman's user avatar
  • 580
2 votes
0 answers
89 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
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
1 vote
0 answers
100 views

Faster methods for performing repeated list manipulations?

I've done my best to pore over the other posts on this site, and to the best of my ability I can't seem to find a good solution to my problem, so I apologize in advance if elements of my question are ...
Texas Red's user avatar
  • 301
0 votes
1 answer
102 views

How can I use Compile to implement recurrence?

I am trying to make the code for the following recurrence. Here wjoin[[i]] is used for calling values from a data set and a is a ...
a b's user avatar
  • 151
10 votes
3 answers
775 views

Can I use Compile to speed up InverseCDF?

I'm repeatedly issuing the command P = InverseCDF[NormalDistribution[0, 1], T] where T is either a 36- or 64-vector of real numbers (points in the unit ...
Paul B. Slater's user avatar
4 votes
1 answer
94 views

Speeding up filling a matrix when approximating a double integral

I want to approximate a double integral in the process of solving a partial-integro differential equation, to then put it, next to the differential part. The integral is (after some simplifications): \...
Faz's user avatar
  • 1,827
7 votes
2 answers
178 views

How to create Functions that have Compiled functions effectively

I'm about to build a package that will provide lots of simple functions. I want these functions to run as fast as possible when evaluating numerically but still provide symbolic results when needed. ...
c186282's user avatar
  • 1,412
5 votes
1 answer
258 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 ...
Quit007's user avatar
  • 1,275
3 votes
2 answers
375 views

My code for solving n queens problem Compile Failed

I want to make my code for solving n-queens problem faster, but it seems that MapIndexed can't be compiled. Mathematica return CompiledFunction::cfse: Compiled ...
expression's user avatar
  • 5,692
23 votes
3 answers
4k 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 ...
István Zachar's user avatar
17 votes
1 answer
541 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 ...
Mr.Wizard's user avatar
  • 273k
10 votes
6 answers
2k 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 ...
chyanog's user avatar
  • 15.8k
7 votes
2 answers
790 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 ...
sasaborg's user avatar
14 votes
1 answer
554 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 ...
Ajasja's user avatar
  • 13.8k
8 votes
3 answers
736 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 ...
asim's user avatar
  • 1,885