Do[Compile[{{aFile[[i, 1]], _Real}, {aFile[[i, 2]], _Real}, {aFile[[i,3]], _Real}},
col1 = aFile[[i, 1]];
col2 = aFile[[i, 2]];
col3 = aFile[[i, 3]];
g1 = col1 col3;
g2 = col2 col3;
g3 = g1 g2^2;];,
CompilationOptions → {InlineExternalDefinitions → True},
RuntimeOptions → “Speed”],
{i, 100000}];
CompliationOptions needs to be part of the call to Complie[], not do. Try something like this:
Do[
Compile[
{
{aFile[[i, 1]], _Real},
{aFile[[i, 2]], _Real},
{aFile[[i, 3]], _Real}
},
col1 = aFile[[i, 1]];
col2 = aFile[[i, 2]];
col3 = aFile[[i, 3]];
g1 = col1 col3;
g2 = col2 col3;
g3 = g1 g2^2;
, CompilationOptions -> {InlineExternalDefinitions -> True},
RuntimeOptions -> "Speed"
]
, {i, 100000}
];
Is there a reason for wanting to compile100,000 functions that are essentially the same?
Thanks I will try your code and let you know the results.
I imported “aFile” which is a file with 3 columns and 100,000 rows with different values.
Hi Mike,
Your code worked in Mathematica. I tried the same code using the IkernelLink(MathLinkFactory) and MathKernel in C#.Net 2019, but it did not work.
I created a string “codeString” equal to the code
and used mathlink.EvaluateToOutputForm(codeString,0);
This worked for all other code expect the one above. Any thoughts?