|
- A variable whose values form an arithmetic progression
- Variables are usually expressed as function of loop index
- Elimination reduces number of operations inside the loop
- Increases parallelization by reducing dependence cycles
for i =1,n
j = 2 * i + 1
A[i] = (A[i] + B[j])/2
endfor |
for I = 1,n
A[i] = (A[i] + B[2*i+1])/2
endfor |
- Induction variable form a series except first or the last term
- Parial loop unrolling may be required
j = n
for I = 1,n
A[i] = (B[i]+B[j]))/2
j = I
endfor
A[1] = (B[1]+B[n])/2
for I = 2,n
A[i] = (B[i] + B[i-1])/2
endfor |
Index Recurrence
- Loop defined index variables are used to index array elements
- Their values do not form a progression
for I = 1,n
j = j +I
A[i] = A[i] + B[j]
endfor |
for I = 1,n
A[i]=A[i]+B[i*(i+1)/2]
endfor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|