Skip to content

Commit 63257f6

Browse files
committed
fixed typos in readme
1 parent edee698 commit 63257f6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Strassen Matrix Multiplication/README.markdown

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ matrix A = |1 2|, matrix B = |5 6|
1818
A * B = C
1919
2020
|1 2| * |5 6| = |1*5+2*7 1*6+2*8| = |19 22|
21-
|3 4| |7 8| |3*5+4*7 3*6+4*8| |43 48|
21+
|3 4| |7 8| |3*5+4*7 3*6+4*8| |43 50|
2222
```
2323

2424
What's going on here? To start, we're multiplying matricies A & B. Our new matrix, C's, elements `[i, j]` are determined by the dot product of the first matrix's ith row and the second matrix's jth column. See [here](https://www.khanacademy.org/math/linear-algebra/vectors-and-spaces/dot-cross-products/v/vector-dot-product-and-vector-length) for a refresher on the dot product.
@@ -72,7 +72,7 @@ Then, for each row in A and column in B, we take the dot product of the ith row
7272

7373
```swift
7474
for k in 0..<n {
75-
C[i, j] = A[i, k] * B[k, j]
75+
C[i, j] += A[i, k] * B[k, j]
7676
}
7777
```
7878

@@ -90,7 +90,7 @@ public func matrixMultiply(by B: Matrix<T>) -> Matrix<T> {
9090
for i in 0..<n {
9191
for j in 0..<n {
9292
for k in 0..<n {
93-
C[i, j] = A[i, k] * B[k, j]
93+
C[i, j] += A[i, k] * B[k, j]
9494
}
9595
}
9696
}
@@ -229,7 +229,7 @@ for i in B.rows {
229229
}
230230
```
231231

232-
Finally, we recusrisvely compute the matrix using Strassen's algorithm and the transform our new matrix `C` back to the correct dimensions!
232+
Finally, we recursively compute the matrix using Strassen's algorithm and the transform our new matrix `C` back to the correct dimensions!
233233

234234
```swift
235235
let CPrep = APrep.strassenR(by: BPrep)

0 commit comments

Comments
 (0)