I'm in the process of trying to apply my java code to work under swift language and am running into some issues.
Part of my code in Java makes use of the math.pow(number,power) and math.exp() but I'm not entirely sure of how I would go about using that in swift language.
For example, in Java:
diffAggregate = 0;
for (kIndex = 0; kIndex < NK_VALUES.length; kIndex ++) {
diffSegment = NKVALUES[kIndex];
diffSegment *= Math.pow(rhoR, IK_VALUES[kIndex]);
diffSegment *= Math.pow(tempR, JK_VALUES[kIndex]);
iFactor = 0;
if (LK_VALUES[kIndex] > 0 {
diffSegment *= Math.exp(-1 * Math.pow(rhoR,LK_VALUES[kIndex]);
iFactor = LK_VALUES[kIndex] * Math.pow(rhoR, LK_VALUES[kIndex]);
}
if (PK_VALUES[kIndex] > 0 {
diffSegment *= Math.exp(-1 * PK_VALUES[kIndex] * Math.pow(rhoR, 2) - BK_VALUES[kIndex] * Math.pow(tempR - UK_VALUES[kIndex], 2));
iFactor = 2 * rhoR * PK_VALUES[kIndex] * (rhoR - 1);
}
diffAggregate += (diffSegment * (IK_VALUES[kIndex] - iFactor));
}
Any help would be greatly appreciated! Thank you so much in advance.