====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gibson:teaching:spring-2016:math445:lab5 [2016/02/18 08:34] gibson |
gibson:teaching:spring-2016:math445:lab5 [2016/02/18 08:36] (current) gibson |
||
---|---|---|---|
Line 77: | Line 77: | ||
---- | ---- | ||
- | **Problem 7:** The formula for matrix-matrix multiplication $C = AB$ is | + | **Problem 7:** The formula for matrix-matrix multiplication $C = AB$ of an $m \times n$ matrix $A$ and an, $n \times p$ matrix $B$ is |
<latex> | <latex> | ||
- | C_{i,j} = \sum_{k=1}^n A_{ij} x_j \quad \text{ for } i = 1,\dots,m, \text{ and } j = 1,\dots,p, | + | C_{i,j} = \sum_{k=1}^n A_{ik} B_{k,j} \quad \text{ for } i = 1,\dots,m, \text{ and } j = 1,\dots,p, |
</latex> | </latex> | ||
- | In this formula, $A$ is an $m \times n$ matrix, $B$ is an $n \times p$ matrix, and the product $C = AB$ is an $m \times p$ matrix. | + | The product $C = AB$ is an $m \times p$ matrix. |
Write a function ''matmatmult'' that takes a matrix $A$ and a vector $x$ as inputs, computes $C = AB$ according to that formula, and returns the matrix $C$. Compare your ''matmatmult'' to Matlab's built-in matrix-vector multiplication operator ''*'' on a random $4 \times 3$ matrix $A$ and a random $3 \times 5$ matrix B. | Write a function ''matmatmult'' that takes a matrix $A$ and a vector $x$ as inputs, computes $C = AB$ according to that formula, and returns the matrix $C$. Compare your ''matmatmult'' to Matlab's built-in matrix-vector multiplication operator ''*'' on a random $4 \times 3$ matrix $A$ and a random $3 \times 5$ matrix B. | ||