Stream: helpdesk (published)

Topic: convert eltype in generic way


view this post on Zulip Gustavo Goretkin (Apr 13 2021 at 02:51):

I'm looking for something that has approximately the same behavior as

convert_eltype(T,x) = convert(typeof(similar(x, T)), x)

i.e. it would preserve the <:AbstractArray type (e.g. StaticArray, OffsetArray, ...)

Related: https://github.com/JuliaGPU/Adapt.jl


Last updated: Oct 02 2023 at 04:34 UTC