As a toy example, I'm trying to write something that computes 2nd order
statistics of complex variables.
give a type T :: Complex{FLT}, I need to get the scalar type associated with
it. For example, Complex{Float64} -> Float64
The decomplexify metafunction seems to do it:
decomplexify{T}(::Type{Complex{T}}) = T
julia> decomplexify(Complex{Float64})
Float64
But I don't know how to get this to work:
type var{T}
sum::T
sumsqr::Type{decomplexify{T}}
end
It's trying to say that sum has type e.g., Complex{Float64}, while
sumsqr has type Float64 (here, T would have type Complex{Float64})
Any documents I can read to help?