I am trying to optimize my Julia code by making it type-stable. Hence, I tried to declare the variable types in the function headers. But one of the variables has a type of ::SentinelArrays.ChainedVector{Float64,Array{Float64,1}} as shown in the code snippet below.
The code example:
df=CSV.read("text.csv", DataFrame)
a = view(df, :, 1)
#this has a type of ::SentinelArrays.ChainedVector{Float64,Array{Float64,1}}
b = view(df, :, 2:4)
#while type of this is ::Arrays{Float64,2}
#I would like to pass the type of the arrays in the function.
function calc(a, b::Arrays{Float64,2})
a+b
end
I tried passing the typeof(a) in the function calc(a::SentinelArrays.ChainedVector{Float64,Array{Float64,1}}, b::Arrays{Float64,2}) however, this throws an error of no method matching.
May I know the correct way to assign this type or maybe if can convert this to normal Array{Float64,1}.
Please suggest a solution to this issue. Thanks in advance.