[R] Fwd: Quadratic programming, for loop

Boris Steipe
Wed, 13 Jun 2018 12:52:10 -0000

Q[j-2] gives you Q[0] in your first inner loop iteration.
R arrays start at one.

B.


> On 2018-06-13, at 07:21, Maija Sirkj?rvi <maija.sirkjarvi at
gmail.com> wrote:
>
>  Amat[J-1+j-2,j-1]= 1/(Q[j] - Q[j-1]) + 1/(Q[j-1] - Q[j-2])