I need to perform the square root of an array in Julia but it seems sqrt()
function just performs square roots on scalars and square matrices.
Is there any simple compact way to do it without using loops?
The documentation https://docs.julialang.org/en/v1/manual/arrays/#Array-and-Vectorized-Operators-and-Functions-1 tells you that to apply any function elementwise over an array, use the dot-broadcasting syntax:
sqrt.(x)
.√(x)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With