Skip to content

Commit

Permalink
Unroll correlation loops in init_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
sjperkins committed Nov 5, 2024
1 parent 6857959 commit 878f14b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions africanus/experimental/rime/fused/terms/cube_dde.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,70 +235,70 @@ def beam(
md = vm - gm0

# Zero the accumulators
for co in range(ncorr):
for co in numba.literal_unroll(range(ncorr)):
absc_sum[co] = 0
corr_sum[co] = 0

# Lower cube
weight = (1.0 - ld) * (1.0 - md) * nud

for co in range(ncorr):
for co in numba.literal_unroll(range(ncorr)):
value = beam[gl0, gm0, gc0, co]
absc_sum[co] += weight * np.abs(value)
corr_sum[co] += weight * value

weight = ld * (1.0 - md) * nud

for co in range(ncorr):
for co in numba.literal_unroll(range(ncorr)):
value = beam[gl1, gm0, gc0, co]
absc_sum[co] += weight * np.abs(value)
corr_sum[co] += weight * value

weight = (1.0 - ld) * md * nud

for co in range(ncorr):
for co in numba.literal_unroll(range(ncorr)):
value = beam[gl0, gm1, gc0, co]
absc_sum[co] += weight * np.abs(value)
corr_sum[co] += weight * value

weight = ld * md * nud

for co in range(ncorr):
for co in numba.literal_unroll(range(ncorr)):
value = beam[gl1, gm1, gc0, co]
absc_sum[co] += weight * np.abs(value)
corr_sum[co] += weight * value

# Upper cube
weight = (1.0 - ld) * (1.0 - md) * inv_nud

for co in range(ncorr):
for co in numba.literal_unroll(range(ncorr)):
value = beam[gl0, gm0, gc1, co]
absc_sum[co] += weight * np.abs(value)
corr_sum[co] += weight * value

weight = ld * (1.0 - md) * inv_nud

for co in range(ncorr):
for co in numba.literal_unroll(range(ncorr)):
value = beam[gl1, gm0, gc1, co]
absc_sum[co] += weight * np.abs(value)
corr_sum[co] += weight * value

weight = (1.0 - ld) * md * inv_nud

for co in range(ncorr):
for co in numba.literal_unroll(range(ncorr)):
value = beam[gl0, gm1, gc1, co]
absc_sum[co] += weight * np.abs(value)
corr_sum[co] += weight * value

weight = ld * md * inv_nud

for co in range(ncorr):
for co in numba.literal_unroll(range(ncorr)):
value = beam[gl1, gm1, gc1, co]
absc_sum[co] += weight * np.abs(value)
corr_sum[co] += weight * value

# Assign interpolated values
for co in range(ncorr):
for co in numba.literal_unroll(range(ncorr)):
div = np.abs(corr_sum[co])
value = corr_sum[co] * absc_sum[co]

Expand Down

0 comments on commit 878f14b

Please sign in to comment.