In the following code there is type instability of the map():
using StaticKernels;
numRows = 400;
numCols = 400;
mI = rand(numRows, numCols);
kernelRadius = 5;
kernelLen = (2 * kernelRadius) + 1;
kernelNumPx = Float64(kernelLen * kernelLen);
mK = Kernel{(-kernelRadius:kernelRadius, -kernelRadius:kernelRadius)}(@inline mW -> (sum(mW) / kernelNumPx));
typeof(mI)
typeof(map(mK, mI))
typeof(sum(mI) / kernelNumPx)
The output is given by:
julia> typeof(mI)
Matrix{Float64} (alias for Array{Float64, 2})
julia> typeof(map(mK, mI))
Matrix{Any} (alias for Array{Any, 2})
julia> typeof(sum(mI) / kernelNumPx)
Float64
In the following code there is type instability of the
map():The output is given by: