I have formed the above problem, which involves a mix between element-wise (Hadamard) multiplication (indicated by ".*") and ordinary matrix multiplication. In this problem I know all of A, B and C but I still have no idea how to solve for X.
Dimensions, if this helps:
- A = N x N (sparse)
- B = N x N (sparse)
- C = N x 1 (not sparse)
- X = N x 1 (not sparse)
The sparse matrices above are populated only with either 0 (of course), +1, or -1.
Alternatively, the problem can also be stated in the form:
log(C) + log(BX) = log(AX)
In a simpler form of the problem, A and B were so sparse that they had only one entry (+1) per row. I found (clumsily) that I was able to go like this:
log(C) + B * log(X) = A * log(X)
... which is easy enough to solve, and gave the correct solution (I am just doing some modelling, so can check against whatever X I use). However, in the "real" problem, my clumsy attempt to pull A and B outside the log operator does not work out.
Does anyone have any ideas on how I can go about solving this problem? It seems I need either
- Some fancy method to combine Hadamard and ordinary matrix multiplication
- Some fancy method to express the logarithm of ordinary matrix multiplication
- Something else I have no idea about (likely)
Many thanks in advance!
$\endgroup$1 Answer
$\begingroup$The Hadamard product of two vectors is the same as the matrix product of one vector with the diagonal matrix of the other vector. Namely$$ C.*(BX) = D_CBX $$where$$ D_C = \begin{bmatrix} c_1&0&\dots&0\\ 0&c_2&&\vdots\\ \vdots&&\ddots&0\\ 0&\dots&0&c_N \end{bmatrix} $$
Then the equation reduces to$$(D_CB-A)X = 0$$
$\endgroup$ 1