I have a function that works well in Mathematica. I am trying to figure out how to compile this function and produce the C code for the entire function. I have read the documentation and can see how to do it with simple functions but I cannot figure out how to include a function that has several lines that are dependent on the results from the previous lines. For example, my Mathematica code is:
{xcorrs1, xcorrs2} =
CanonicalWarpingCorrespondence[s1, s2,
Automatic, {"SlantedBand", band},
Method -> {"MatchingInterval" -> Automatic},
DistanceFunction -> distfunc]; d1 = Part[s1, xcorrs1]; d2 =
Part[s2, xcorrs2]; dist =
CanonicalWarpingDistance[s1, s2, Automatic, {"SlantedBand", band},
Method -> {"MatchingInterval" -> Automatic},
DistanceFunction -> distfunc]; outtopp = {dist, d1, d2}
I will provide the following variables to the function:
distfunc that will be the Distance measure to use (string),
s1 that will be a single-dimensional array of numerical values,
s2 that will be a single-dimensional array of numerical values and
band that will be an integer representing the desired band width to use for the canonical time warping
The function will return a string that will consist of the concatenated output from dist, d1 and d2.
Ultimately I want to incorporate this into a dll to use with vb.net in Visual Studio but at the moment I just need the C code. Any suggestions would be greatly appreciated.
Sample input is in the attached file.
The output using the example input should be the following string:
{7160.47, {41., 47.903,
33., -5., -12.677, -20., -11., -18.876, -11., -20., -28.646, -21.,
-15., -23.738, -15., -21., -25.161, -25.161, -25.161, -25.161, -16.,
-1., 2.826, 7., 7., 7., 7., 12.736, 12.736, 12.736, 12.736, 12.736,
12.736, 12.736, 12.736, 12.736, 9., 9., 9., 14., 14., 14., 14.,
11.417, 6., -14., -24.368, -22., -19., -28.863, -19., -21.,
-33.117, -23., -24., -35.696, -24., -24., -26.076, -14., 6., 6., 6.,
6., 6., 6., 3.654, 6., -14., -9.964, -8., 24., 28.462,
24., -8., -14.461, -19.}, {9., 12.309, 2., 2., 11., 11., 11., 11.,
11., 11., 11., 11., 11., 11., 11., 11., 25.179, 22., 34., 40.08,
26., -3., -7.628, -13., -6., -10.917, -6., -13., -22.032, -17.,
-17., -25.736, -17., -17., -21.37, -13., -4., -8.272, -4., -13.,
-21.37, -17., -17., -17.535, -9., 7., 15.273, 15.273, 15.273, 15.273,
15.273, 15.273, 16., 16., 16., 16., 16., 16., 15.273,
7., -9., -17.535, -17., -17., -21.37, -13., -4., -4.568, 0., 0.,
0., -2., -6.551, -6., -13., -22.032, -17.}}
SampleInput.txt (850 Bytes)
