1
votes

While I'm using julia to compile a .jl file

pixelscale=4e-4
psfsize=4191.00

span = (2*pixelscale * floor(psfsize/2))/(psfsize-1)
temx = [-pixelscale * floor(psfsize/2)]
for i in psfsize
    b=-pixelscale * floor(psfsize/2) + i*span
    push!(temx,b)
end

meshtheta = temx   
meshphi = temx'
R_pup = sqrt(meshphi^2 + meshtheta^2)

temx is a one dimensional array and temx' is transposed from temx and error occurs:

LoadError: MethodError: convert(::Type{Union{}}, ::LinearAlgebra.Adjoint{Float64,Array{Float64,1}}) is ambiguous.

I can't see why it's wrong.Does anyone have any idea?

1
I'm not sure, what are you trying to achieve with your last line? What is the expected result?ginkul
square of a row or column vector doesn't make sense, what are you trying to do?jling
yes,square of a row or column vector doesn't make sense. Since the last time I'm using this code is in python,and python reshaped the array while computing, so now I need to do some reshaping with my arrays,thanks for your time!miao
@jling can you convert your comment to a general answer?logankilpatrick

1 Answers

0
votes

The error you're seeing comes from this:

julia> a = rand(2);

julia> a'
1×2 adjoint(::Vector{Float64}) with eltype Float64:
 0.985248  0.651835

julia> (a')^2
ERROR: MethodError: convert(::Type{Union{}}, ::LinearAlgebra.Adjoint{Float64, Vector{Float64}}) is ambiguous. Candidates:

This is essentially because squaring a row or column vector doesn't make mathematical sense thus is undefined in Julia.

If you want element-wise sqaure, do a' .^ 2 instead.