Python code moving to Julia

Assuming that u[:, k] is a slice of an array with multiple values and u_approx is a scalar, you need u[:, k] .= u_approx to set every entry of that slice to the scalar. In numpy, I think this automatically broadcasts (expands the scalar to the slice size).

2 Likes