# X\[a,1\]'\*b\[a\]==sum(x\[a,1\].\*b\[a\])?

**URL:** <https://discourse.julialang.org/t/x-a-1-b-a-sum-x-a-1-b-a/62499>\
**Category:** General Usage\
**Created:** [June 7, 2021, 8:07am UTC](https://discourse.julialang.org/t/x-a-1-b-a-sum-x-a-1-b-a/62499 "2021-06-07T08:07:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BYS](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bys/32/25384_2.png) [@BYS](https://discourse.julialang.org/u/BYS)\
**Post date:** [June 7, 2021, 8:07am UTC](https://discourse.julialang.org/t/x-a-1-b-a-sum-x-a-1-b-a/62499/1 "2021-06-07T08:07:21Z")

</div>

Hi, all  
If I input the following codes,

```julia
julia> b[a]
3-element Array{Any,1}:
 1
 2
 3
julia> a
3-element Array{Int64,1}:
 2
 3
 4
julia> model=Model();
julia> @variable(model,x[1:10,1:20])
julia> x[a,1]'*b[a]

```

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!

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [June 7, 2021, 9:39am UTC](https://discourse.julialang.org/t/x-a-1-b-a-sum-x-a-1-b-a/62499/2 "2021-06-07T09:39:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BYS](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bys/32/25384_2.png) [@BYS](https://discourse.julialang.org/u/BYS)\
**Post date:** [June 7, 2021, 11:55am UTC](https://discourse.julialang.org/t/x-a-1-b-a-sum-x-a-1-b-a/62499/3 "2021-06-07T11:55:54Z")

</div>

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}.
