Given p matrices M of shape (p, n, n) and p vectors V of shape (p, n, 1), compute sum_k M[k] @ V[k] — the sum of the p matrix products — in a single vectorized call rather than a Python loop. Return the (n, 1) result.
p
M
(p, n, n)
V
(p, n, 1)
sum_k M[k] @ V[k]
(n, 1)
solve(...)