Writing into an array like it is memory
Chapter 01's first invariant, met as an error message. A jnp array is a value, not a place, so there is nothing to write into. .at[...].set expresses the same intent as a pure function, and XLAThe compiler: brilliant at fusing along dataflow edges, structurally unable to change your algorithm. That gap is why kernels exist.taught in /l/xla → reuses the old buffer when the old value is dead.
import jax.numpy as jnp
x = jnp.zeros(3)
x[0] = 1.0 # NumPy habit: update the array in placeimport jax.numpy as jnp
x = jnp.zeros(3)
x = x.at[0].set(1.0) # a new array; under jit the copy is usually elided