Set of quadratic forms in compact notation

65 Views Asked by At

I've got a set of $M$ ratios of the form $$\frac{\boldsymbol{a}_m^\intercal\boldsymbol{x}}{\boldsymbol{x}^\intercal \boldsymbol{B}_m \boldsymbol{x}},$$ where $\boldsymbol{x}, \boldsymbol{a}_m \in \mathbb{R}^N$ and $\boldsymbol{B}_m \in \mathbb{R}^{N \times N}$. I'd like to write these ratios as a single ratio whose output is a vector $\boldsymbol{y} \in \mathbb{R}^M$, with $y_m = \frac{\boldsymbol{a}_m^\intercal\boldsymbol{x}}{\boldsymbol{x}^\intercal \boldsymbol{B}_m \boldsymbol{x}}$.

The numerator is straightforward. I would define matrix $\boldsymbol{A} \in \mathbb{R}^{N \times N}$ by concatenating vectors $\boldsymbol{a}_m$ as $[\boldsymbol{a}_1,\dots,\boldsymbol{a}_N]$ and write it as $\boldsymbol{A}^\intercal \boldsymbol{x}$. On the other hand, the quadratic form at the denominator is giving me trouble. If I were writing code, I'd go for a 3D array by concatenating matrices $\boldsymbol{B}_m$. This makes me think about tensors and tensor product but I'm really no expert on them.

Any suggestions? Thank you.