If I have a matrix $\mathbf{A}\in R^{m\times n}$, I'd like to express in matrix notation (or at least in a good mathematical notation) the vector $\mathbf{z}\in R^{m}$ whose $i$-th component is the product of all non zero entries in the $i$-th row of $\mathbf{A}$.
I know there are some operators in some programming languages like prod that makes the product of a row/column vector entries, and some procedural ways to get the nonzero elements, but I am looking for a way to formalize this in a formula, if there is a common way to do it.
It is reasonable to go with $$ z_i = \prod_{\{j: A_{ij} \neq 0\}} A_{ij} $$ In the event that all elements are zero, this is the empty product, which is conventionally taken to be $1$.