Conversion from float to complex?

As of right now, your code does not run in an empty julia REPL. This is because your line

@. R = sqrt((xx - 0.5)^2 + (yy - 0.5)^2)

inserts the computed values on the right hand-side into an existing matrix R, which is not defined in your code snippet. In your session, you probably have an existing complex matrix R, which causes the problem. If you change this line to

R = @. sqrt((xx - 0.5)^2 + (yy - 0.5)^2)

The problem should be solved, because this will create a new matrix which is correctly inferred to have real elements.

6 Likes