1

I understand that when calculating the product of 2 matrices you need to account for the dimensions. But when there is an empty row in one of the matrices, why does it need to be accounted for? What are the implications if you ignore that row before performing a calculation?

Say, if the matrix is $\begin{bmatrix}0&-2\\ -1&4\\ 0&0\\ \end{bmatrix},$

in which ways is it different if the last row was removed?

Jonas Meyer
  • 53,602
Jade
  • 11
  • Multiplication is not defined between any two matrices. You can only multiply an $m \times n$ matrix by an $n \times p$ matrix (yielding an $m \times p$ matrix). In other words, the number of columns of the left matrix must match the number of rows of the right matrix. – Sammy Black Jul 31 '14 at 02:59
  • It depends on what you mean by "ignored". You can always "ignore" zeros in the sense that you don't need to explicitly add the terms corresponding to their products with elements of the other matrix. On the other hand, you have to take their locations into account when deciding what other multiplications and additions to do. – Robert Israel Jul 31 '14 at 05:28

3 Answers3

1

Zero rows or columns can be ignored if they are in the proper orientation (i.e., rows if the matrix is on the left and columne if the matrix is on the right of the product).

If you know in advance that a matrix has (or is likely to have) at least one zero row (or column), it is probably useful to find all such items and modify your loop to take them into account.

Of course, if your hardware makes it much more efficient to do every term in every product, don't bother.

marty cohen
  • 107,799
1

To put it shortly: It cannot be ignored.

A matrix $A$ is not just a bag full of numbers, but is organized information of some sort. An essential part of this organization consists in the number $m$ of rows and the number $n$ of columns of $A$. The rows are in a prearranged $1$-$1$ correspondence with the elements of some set of cardinality $m$ (say, a set of $m$ cities), and the columns are in a $1$-$1$ correspondence with the elements of some other set of cardinality $n$ (say $n$ kinds of crimes). The entry $a_{ik}$ of $A$ might be the number of crimes of kind$_k$ that have occurred in city$_i$ in 2013. If row$_i$ of $A$ is a row of zeros then this is a substantial fact about city$_i\,$, which definitively should not be ignored but carried through the whole statistical, resp. computational, analysis of the data.

0

When multiplying, rows with 0's have to be considered because if not, the order of the matrices will not be defined.

S.Dan
  • 1,115