@@ -645,20 +645,15 @@ efficient machine code that varies with both task size and hardware.
|
645 | 645 | We saw the power of JAX's JIT compiler combined with parallel hardware when we |
646 | 646 | {ref}`above <jax_speed>`, when we applied `cos` to a large array. |
647 | 647 | |
648 | | -Let's try the same thing with a more complex function. |
649 | | - |
650 | | - |
651 | | -### Evaluating a more complicated function |
652 | | - |
653 | | -Consider the function |
| 648 | +Let's try the same thing with a more complex function: |
654 | 649 | |
655 | 650 | ```{code-cell} |
656 | 651 | def f(x): |
657 | 652 | y = np.cos(2 * x**2) + np.sqrt(np.abs(x)) + 2 * np.sin(x**4) - x**2 |
658 | 653 | return y |
659 | 654 | ``` |
660 | 655 | |
661 | | -#### With NumPy |
| 656 | +### With NumPy |
662 | 657 | |
663 | 658 | We'll try first with NumPy |
664 | 659 | |
@@ -675,7 +670,7 @@ with qe.Timer():
|
675 | 670 | |
676 | 671 | |
677 | 672 | |
678 | | -#### With JAX |
| 673 | +### With JAX |
679 | 674 | |
680 | 675 | Now let's try again with JAX. |
681 | 676 | |
@@ -712,10 +707,10 @@ The outcome is similar to the `cos` example --- JAX is faster, especially on the
|
712 | 707 | second run after JIT compilation. |
713 | 708 | |
714 | 709 | However, with JAX, we have another trick up our sleeve --- we can JIT-compile |
715 | | -the *entire* function, not just individual operations. |
| 710 | +the entire function, not just individual operations. |
716 | 711 | |
717 | 712 | |
718 | | -### Compiling the whole function |
| 713 | +### Compiling the Whole Function |
719 | 714 | |
720 | 715 | The JAX just-in-time (JIT) compiler can accelerate execution within functions by fusing array |
721 | 716 | operations into a single optimized kernel. |
|