## 2015年7月11日 星期六

### [ MIT Class ] Linear Algebra, Spring 2005 - Lec3

Source From Here
Preface

Matrix Multiplication

Multiplication - Way 1

1. // Multiplication W1
2. // A(mxn) * B(nxp) = C(mxp)
3. // C(c1) = A*(Column 1 of B) <--- a="" column="" combinatioin="" of="" span="">
4. // C(c2) = A*(Column 2 of B)
5. // ...
6. Matrix A = LA.newMtx3(23, [1,2,3,4,5,6])
7. Matrix B = LA.newMtx3(32, [1,0,0,2,1,0])
8. Matrix C = A*B
9. printf("%s\n", C)
10. // First column of C ---> c1
11. Matrix O = A.col2Mtx(0)*B.val(00)+A.col2Mtx(1)*B.val(10)+A.col2Mtx(2)*B.val(20)
12. assertEquals(O.c(0), C.c(0))
13. // Second column of C ---> c2
14. O = A.col2Mtx(0)*B.val(01)+A.col2Mtx(1)*B.val(11)+A.col2Mtx(2)*B.val(21)
15. assertEquals(O.c(0), C.c(1))

Multiplication - Way 2

1. // Multiplication W2
2. // A(mxn) * B(nxp) = C(mxp)
3. // C(r1) = (Row 1 of A)*B
4. // C(r2) = (Row 2 of A)*B
5. // ...
6. // First row of C ---> r1
7. O = B.row2Mtx(0)*A.val(00)+B.row2Mtx(1)*A.val(01)+B.row2Mtx(2)*A.val(02)
8. assertEquals(O.r(0), C.r(0))
9. // Second row of C ---> r2
10. O = B.row2Mtx(0)*A.val(10)+B.row2Mtx(1)*A.val(11)+B.row2Mtx(2)*A.val(12)
11. assertEquals(O.r(0), C.r(1))
Multiplication - Way 3
(13:40) 接著考慮 Column of A x Row of B:

Multiplication - Way 4

Inverse Matrix
(24:00) 接著看 Invertible Matrix

Gauss-Jordan
(34:30) 這裡開始解釋如何求 Matrix A 的反矩陣. 一個做法是使用 Gauss-Jordan Reduction

Supplement
Inverse of a matrix by Gauss-Jordan elimination

### [ JS 常見問題 ] Time difference in Nodejs?

Source From   Here   Question   Im trying to figure out a way to   get the time difference in seconds between two dates . For example, diff...