how to generate non-negative matrices whose product's values lie in a certain range?

81 Views Asked by At

So let's say I need two non-negative matrices $A\in\mathbb{R}^{m\times k},B\in\mathbb{R}^{k\times n}$ of rank $k$ s.t. $\forall i,j.0 \leq (AB)_{ij} \leq 255$ .

Without the non-negativity, I'd just generate a Matrix $X=USV^T$ of random values in range $[0,255]$ and use its SVD to assign $A = U \sqrt{S}, B = \sqrt{S}V^T$.

I have no idea, however, how to enforce the non-negativity.

How do I do that?

1

There are 1 best solutions below

4
On BEST ANSWER

Take ANY $A,B$ with nonnegative elements and rank $k$ such that $AB\ne 0$. The matrix $AB$ has nonnegative elements, and if $c$ is the maximum element in $AB$, then $0\le 255*(AB)_{ij}/c\le 255$, so $255*A$ and $B/c$ are your wanted matrices.