Sunday, August 13, 2017

linear algebra notes 08//13/2017 lecture 5 & 6

lecture 5:

LU 分解的意义:
http://blog.csdn.net/carrierlxksuper/article/details/8487276

permutation:
P-1 = Pt
一共n!个permutation matrix

transpose 的概念

symmetric matrix:
At = A

Rt*R is always symmetric.
WHY? Take transpose!
(RtR)t = Rt*Rtt = Rt*R  (和逆矩阵的公式很像 (AB)-1 = B-1A-1)
所以这个是symmetric的


Vector space
Example: R2 = all 2 dimensional vectors

a vector space inside R2 is : a subspace of R2
一定得过零点

subspace of R2
1. all of R2 (最大子空间)
2. any lines through [0;0]
3. zero vector only (最小子空间)
子空间 补充:https://www.zhihu.com/question/48849797

column space: columns in Rn. Add their combinations form a subspace . (满足定义)


lecture 6:

Ax=b 有解 当b in A的column spaces (根据定义来的)

主列

null space (零空间) of A
all vectors x to let Ax = 0
at least contains [0;0;0]

solutions to Ax = 0 always gives a subspace.

subspace 一定会过零点







Friday, August 11, 2017

MIT linear algebra course note

08/11/2017 lecture 1 & 2
1. permutation matrix
2. inverse matrix E*E-1 = I
3. identity matrix
4. 如何做矩阵变换。E*A=B 使得 第二行substract 第一行

08/12/2017 lecture 3&4
4种方法计算矩阵乘法:
1. 正常法,每个值都是1 row * 1 column
2. column way. A乘以B的每个column
3. row way. A的每个row 乘以B
4. A的每个column 乘以 B的每个row。加在一起
5. cut matrix into blocks。 然后把每个block之间进行运算

A的左逆 矩阵和右逆矩阵是相同的 if matrix is invertible (non singular)

Singular case (no inverse)
比如[1,3;2,6]

singular matrix can get 0 by some matrix x
Ax = 0 if A is singular matrix. x 是存在的

A times B的一列j,得到的是结果的C的一列j
A的一行j times B,得到的是结果的C的一行j

Gauss - Jordan (solve 2 equations at once)
[A,I]--->[I,A-1]




AB 的逆矩阵 = B-1A-1

矩阵的转置
(A-1)t = (At)-1
A 的逆矩阵的转置是A的转置的逆矩阵
A= LU
if there is no row exchange, the multiplers will directly go into L

how many operations on n *n matrix?
n^3

permutation:
可以在单元矩阵中变换

原矩阵乘以这个矩阵(permuatation matrix)表示第二行第三行互换

permutation matrix : p-1 = pt 如果第二行和第三行 换了,那么再换一次第二行和第三行就是还是原来的矩阵

置换矩阵(Permutation matrix):矩阵的每一行和每一列的元素中只有一个1,其余元素都为0。(不严谨的解释)
转置矩阵(Transpose matrix):矩阵的行变成对应的列,矩阵的列变成对应的行。(不严谨的直白解释)
性质:置换矩阵(P)的逆是其(置换矩阵自己的)转置(T),
即:P^(-1)= P^T
如:3×3的置换矩阵群(共3! = 6个,补充4×4的置换矩阵共4! = 4×3×2×1 = 24个)
1 0 0 | 0 1 0
0 1 0 | 1 0 0
0 0 1 | 0 0 1
----------------
0 0 1 | 1 0 0  
0 1 0 | 0 0 1 
1 0 0 | 0 1 0 
置换矩阵的逆=置换矩阵的转置(上面4个置换矩阵的转置矩阵都是自身,又因为他们的逆=他们的转置,所以他们的逆=自身)

0 1 0 | 0 0 1 
0 0 1 | 1 0 0 
1 0 0 | 0 1 0 
置换矩阵的逆=置换矩阵的转置(这两个矩阵的转置=对方,因此这两个矩阵的逆=对方)

LU分解

LU分解是指,把矩阵分解为 消元矩阵E 的逆操作 L(下三角)
和 A 被消元后的结果矩阵 U(上三角)的乘积.
  • LU分解不借助 行交换的关键是是 中间不能出现 0 pivot
  • 但是对最后一个 pivot 没有 非0的要求
  • 因为奇异矩阵也有LU分解

http://blog.csdn.net/qq_25834201/article/details/59748093
http://blog.csdn.net/lc013/article/details/52244464
https://github.com/mebusy/notes/blob/master/dev_notes/LinearAlgebra.md

Sunday, July 30, 2017

quickly log in remote sever

reference:
http://blog.csdn.net/leexide/article/details/17252369
https://my.oschina.net/aiguozhe/blog/33994

process:
local server:
1. ssh-keygen -t rsa (连续三次回车,即在本地生成了公钥和私钥,不设置密码)
2. ssh root@172.24.253.2 "mkdir .ssh;chmod 0700 .ssh" (需要输入密码, 注:必须将.ssh的权限设为700) (if remote server doesn't have ssh file)
3. scp ~/.ssh/id_rsa.pub root@172.24.253.2:.ssh/id_rsa.pub (需要输入密码)

remote server:
1. 
cat id_rsa.pub >> ~/.ssh/authorized_keys
2. 
 chmod 600 authorized_keys
3.
 chmod 700 -R ~/.ssh
注意都要在对应.ssh 文件目录下进行

Wednesday, July 19, 2017

python write to file buffer

https://stackoverflow.com/questions/18984092/python-2-7-write-to-file-instantly
https://stackoverflow.com/questions/3167494/how-often-does-python-flush-to-a-file
Use flush() or

For file operations, Python uses the operating system's default buffering unless you configure it do otherwise. You can specify a buffer size, unbuffered, or line buffered.
For example, the open function takes a buffer size argument.
"The optional buffering argument specifies the file’s desired buffer size: 0 means unbuffered, 1 means line buffered, any other positive value means use a buffer of (approximately) that size. A negative buffering means to use the system default, which is usually line buffered for tty devices and fully buffered for other files. If omitted, the system default is used."
bufsize = 0
f = open('file.txt', 'w', bufsize)
shareimprove this answer

Tuesday, May 23, 2017

Pages in Canvas

add code in Canvas
<p><code>java -version </code></p>
<pre><code>java -version </code></pre>

add github gist to html:
<iframe title="Code Embed" src="https://gist.github.com/RoyZhengGao/16c8a02c7d1fc90d616cc8f731b31d34.pibb" width="675" height="675" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" mozallowfullscreen="mozallowfullscreen"></iframe>

Thursday, May 11, 2017

Information Theory, Inference and Learning Algorithms Reading

1. preface

 binary symmetric channe
l

 Information theory and coding theory oer an alternative (and much more exciting)
approach: we accept the given noisy channel as it is and add communication
systems  to it so that we can detect and correct the errors introduced by
the channel. As shown in gure 1.6, we add an encoder  before the channel and
a decoder  after it.

Majority-vote
decoding algorithm

chapter 4:The Source Coding Theorem

Saturday, May 6, 2017

html format

add code to html
<code>int</code>

use iframe + github gist to embed long code in Canvas

<p class="p1"><span class="s1"> <iframe title="Code Embed" src="https://gist.github.com/RoyZhengGao/16c8a02c7d1fc90d616cc8f731b31d34.pibb" width="675" height="675" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" mozallowfullscreen="mozallowfullscreen"></iframe></span></p>