If you initialize your vector with zeros(10) or something, you should instead initialize it like zeros(eltype(x), 10) where x is your input vector.
Easiest would be if you could post a small runnable example of something that models what you actually want to do.