Skip to content

Commit

Permalink
Merge pull request #5669 from stuartarchibald/fix/5668
Browse files Browse the repository at this point in the history
Update example in 5m guide WRT SSA type stability.
  • Loading branch information
sklam committed May 5, 2020
2 parents 1ac2c54 + 94227d9 commit ff24fb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/source/user/5minguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Numba works well on code that looks like this::

@jit(nopython=True) # Set "nopython" mode for best performance, equivalent to @njit
def go_fast(a): # Function is compiled to machine code when called the first time
trace = 0
trace = 0.0
for i in range(a.shape[0]): # Numba likes loops
trace += np.tanh(a[i, i]) # Numba likes NumPy functions
return a + trace # Numba likes NumPy broadcasting
Expand Down Expand Up @@ -130,7 +130,7 @@ For example::

@jit(nopython=True)
def go_fast(a): # Function is compiled and runs in machine code
trace = 0
trace = 0.0
for i in range(a.shape[0]):
trace += np.tanh(a[i, i])
return a + trace
Expand Down

0 comments on commit ff24fb1

Please sign in to comment.