In Julia, I can use promote
to make various types of objects compatible. For example:
>promote(1, 1.0)
(1.0,1.0)
>typeof(promote(1, 1.0))
(Float64, Float64)
However, if I use promote
on arrays, it doesn't give me what I want:
>promote([1], [1.0])
([1],[1.0])
>typeof(promote([1], [1.0]))
(Array{Int64,1},Array{Float64,1})
What I want is for the Int64
array to be converted to a Float64
array, so I get something like:
>promote_array([1], [1.0])
([1.0],[1.0])
>typeof(promote_array([1], [1.0]))
(Array{Float64,1},Array{Float64,1})
Here promote_array
is a hypothetical function I made up. I'm looking for a real function that does the same. Is there a function in Julia that does what promote_array
does above?