Tag Info

New answers tagged

2

This works without any error messages: TEST = Compile[{{x, _Real}, {y, _Real}, {z, _Real}}, -x y z]; TESTfn[x_?NumericQ, y_?NumericQ, z_?NumericQ] := TEST[x, y, z]; RegionPlot3D[ImplicitRegion[TESTfn[x, y, z] > 0, {{x, -5, 5}, {y, -5, 5}, {z, -5, 5}}]] The second function, TESTfn, is necessary to ensure you only pass numeric (and not symbolic) ...


3

This is an answer to Q1 and partly Q4, really. I can't test your Fortran version at the moment, but it would be an interesting comparison. You can improve the performance of f4 compared to f1 and f2 by setting RuntimeOptions -> "Speed". Clearly the change in runtime settings (mainly "CatchMachineIntegerOverflow" it seems...) from the defaults has a ...


3

It is true that Outer cannot solve this problem inside Compile. Outside Compile it works to change the head p to something other than List, but Compile doesn't work with general heads. Instead you have to use another function to create the matrix. I suggest: f = Compile[{{p, _Real, 2}}, Table[Which[ 2 < Abs[#1[[1]] - #2[[1]]] < 3 && 2 ...


1

I can't open the 9MB file as it is a .7z extension and I don't know what that is. However, if your expressions has sets of Denominators that are the same then the following will spread the Simplify over your kernels by ParallelMaping it. tmp is the first 5 summands you shared in PasteBin Simplify@Total@ParallelMap[Simplify[Total[#]] &, GatherBy[List ...


4

The problem here is more simple: it's the same error you'd get if you tried matrix[[i, j]]. You told Mathematica to Evaluate the expression matrix[[i,j]] - matrix[[j,i]] before doing the Compile, so it reduces to that problem. The problem is that the symbol i must be an integer to be a valid part specification: Part[{1, 2, 3}, i] throws an error. Of course, ...


0

If you just care about dealing with this issue, @Wizard was correct. Install either Mathematica 9 or 10, problem solved. If you care about Visual Studio 2015, read this: Installed Mathematica 10.0, the CCompilerDriver does not have a pre-built call system for VS2015, you will need to add this by appending lines to the CCompilerDriver.m file found at ...


12

This is not a full answer, but too long for a comment. We can try to look at the C code that Mathematica generates. Needs["CCodeGenerator`"] cf = Compile[{{n, _Integer}}, RandomReal[1, n]] CCodeStringGenerate[cf, "fun"] Excerpt from the output: ... FP0 = funStructCompile->getFunctionCallPointer("RandomReals"); ... err = FP0(libData, 3, FPA, ...



Top 50 recent answers are included