====== 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/16 12:00] vining |
gibson:teaching:spring-2016:math445:lab5 [2016/02/18 08:36] (current) gibson |
||
---|---|---|---|
Line 75: | Line 75: | ||
Write a function ''matvecmult'' that takes a matrix $A$ and a vector $x$ as inputs, computes $y = Ax$ according to that formula, and returns the vector $y$. Compare your ''matvecmult'' to Matlab's built-in matrix-vector multiplication operator ''*'' on a random $4 \times 4$ matrix and a random 4d column vector. | Write a function ''matvecmult'' that takes a matrix $A$ and a vector $x$ as inputs, computes $y = Ax$ according to that formula, and returns the vector $y$. Compare your ''matvecmult'' to Matlab's built-in matrix-vector multiplication operator ''*'' on a random $4 \times 4$ matrix and a random 4d column vector. | ||
- | ...to be continued... | + | ---- |
+ | |||
+ | **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> | ||
+ | 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> | ||
+ | |||
+ | 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. |