I have a simple formula want to insert within my article, however I don't know how to simplify it in matrix form. It would be grateful if you could answer me.
Description of the formula: The notation of A[i] denotes the i-th feature of vector A. Here x_pi and x_qj along with G_q are one dimensional vectors. The result must be a real number.
$Replace\left( {{x_{pi}},{x_{qj}},{G_q}} \right) = \mathop \sum \limits_{f = 1}^d ({x_{pi}}\left[ f \right] - {x_{qj}}\left[ f \right])\left( {2\left( {{x_{qj}}\left[ f \right] - {{\bar x}_q}\left[ f \right]} \right) + ({x_{pi}}\left[ f \right] - {x_{qj}}\left[ f \right])(\left| {{G_q}} \right| - 1)/|{G_q}|} \right)$