Matrix-vector products
A matrix–vector product dots every matrix row with the input vector, producing one output entry per row.
On this page 7 sections
01A matrix–vector product applies each row to the same input#
A matrix–vector product applies each row to the same input. For rows and with input , two dot products produce two output entries.
Take the first row and input . Multiply matching positions, then add. This result becomes the first output entry.
A has rows and . Input is . Compute .
Show answer and explanation
Row 1 gives ; row 2 gives .
02With input (3,1), row (1,2) gives 5#
With input , row gives 5. Row gives . Place those results in row order:
A matrix has 4 rows and 2 columns. The input has 2 entries. How many output entries?
Show answer and explanation
One dot product per row gives four entries.
03Every row needs one input per column#
Every row needs one input per column. A matrix with three rows and two columns takes a two-entry input and returns three entries. A missing input makes the row dot products undefined.
Input . P weights ; Q weights . Dot each with the input. Return (P, Q).
Show answer and explanation
P is ; Q is .
Dot each row with the whole input. Keep the results in row order.
- Compute a matrix-vector product from row dot products.
Sources & further reading
- [1]Margalit and Rabinoff: Interactive Linear Algebra, 2.3 Matrix Equations ↗Margalit and Rabinoff · Book
- [2]Goodfellow, Bengio and Courville: Deep Learning, 2.1–2.2 ↗Goodfellow, Bengio and Courville · Book