Given a function, that accepts a matrix and returns a vector: $g(X):\mathbb{R}^{nxm}\rightarrow \mathbb{R}^{m}$, s.t. $g^{(i)} = t\cdot X^{(i)}$; where $X$ is an $n\times m$ matrix, $t$ is a row vector in $\mathbb{R}^{n}$, $X^{(i)}$ is the $i$-th column vector of $X$, also $n$-dimensional. $g^{(i)}$ is the $i$-th component of the $m$-dimensional vector $g$, hence $i$ runs from 1 to $m$.
If we are given numerically the entries of $X$ and $t$, is it possible to compute the entries of $g$ in a vectorized, non-loop way?
In, e.g., Matlab/Octave using a loop one can do:
for i=1:m
g(i) = dot(t,X(:,i));
end
Is it possible to do this in a vectorized way without the loop in Matlab or Python?
You can use the library numpy.dot() in python.