I have a matrix given as a function of is indices and another free parameter as follows
A[x_, i_, j_] = x*i*j
Now I would like to evaluate this for a given vector of indices $i, j$, e.g.
iVec = {1,2}
jVec = {1,2}
such that the matrix
AMat[x_] = {{x,2*x},{2*x,4*x}}
is returned. We may assume that the matrix is square, i.e. iVec and jVec have the same length and the first argument of the function A is supposed to correspond to the row index of the resulting matrix.
Is there any way to do this? Ideally I would like to write something like
AMat[x_] = A[x, iVec, jVec]
but that will not work because Mathematica doesn't know which vector to treat as a transpose.
EDIT: The input should be A[x_, i_, j_] without modifying it's functional form. The reason is that I compute that automatically.
A[x_,i_,j_]:=x*Outer[Times,i,j]; A[x,{1,2},{1,2}]
? $\endgroup$