there will be an error,
ERROR: MethodError: no method matching zero(::Type{Any})
the expression sum(x[a,1].*b[a]) will not occur error comparing with x[a,1]'*b[a].
Is there some reasons for this occurance?
Thanks a lot!

What is b? From your code, it seems to be an untyped vector, which can hold objects of Any (i.e. all) types. There’s no universal multiplicative identity (i.e., one(x)) for everything, so it fails.

Thank you very much for your reply, Sukera. In fact, b is 10-element Array{Any,1}, and I index vector b with the index a,which a is [2,3,4]. Normally, if b is 10-element Array{float,1}, it can run without errors, but it fails when b is 10-element Array{any,1}.