optimizing indices with array math in F#

Viewed 53

I have code like this:

let mutable j = 0
while j < i - 1 do
    psi.[j] <- phi.[j]
    phi.[i - 1] <- phi.[i - 1] - psi.[j] * cov.[i - j - 1]
    j <- j + 1

Since the loop is moving through the arrays one element at a time, is there a way to make this faster in F#, like with incremented pointers in C/C++?

I'm assuming the indices will be recalculated at each iteration which is not ideal; and this code just one piece, there are a few pieces of code like this in a large loop.

0 Answers
Related