I have the following function which will be evaluated thousands of times in a for loop. This function will generate a vector. Each element in this vector is computed by some algebra of some elements in two different matrices, which are decided by the index in `H_sim_market`

. I wonder if there is a smarter way to code this function?

```
function fun_1_b(z_agent_k_matrix::Matrix{Float64}, z_agent_kk_matrix::Matrix{Float64}, H_sim_market::Vector{CartesianIndex{2}})
z_1_b = Vector{Float64}(undef, length(H_sim_market))
counter = 1
for (i,j) in Tuple.(H_sim_market)
z_1_b[counter] = z_agent_k_matrix[i,j] * (sum(z_agent_kk_matrix[:,j])-z_agent_kk_matrix[i,j])
counter += 1
end
return z_1_b
end
```