title: how to speed up nested loop? Python
body: <pre><code>def model_predykycjny(r):
      macierz_R = np.zeros((r, r))
      for i in range(1, r + 1):
          for j in range(1, r + 1):
              suma_iloczynow = 0
              if i &lt;= j:
                  # I want to speed up this loop
                  for n in range(r, len(fixed_data_channel0)):
                      suma_iloczynow += float(fixed_data_channel0[n - i]) * float(fixed_data_channel0[n - j])
                  macierz_R[i - 1][j - 1] = (np.float(suma_iloczynow))
              suma_iloczynow = 0
  </code></pre>
  <pre><code>time for r =3 : 7.9424097537994385
  </code></pre>