http://linear.ups.edu/jsmath/0212/fcla-jsmath-2.12li103.html
Every time I think I know what's going on, suddenly there's another layer of complications.
2017年2月9日星期四
Eigenvalues of Positive Semi-definite Matrices
Suppose that A is a Hermitian matrix. Then A is positive semi-definite matrix if and only if whenever λ is an eigenvalue of A , then λ≥0 .
http://linear.ups.edu/jsmath/0212/fcla-jsmath-2.12li103.html
http://linear.ups.edu/jsmath/0212/fcla-jsmath-2.12li103.html
2017年2月4日星期六
2017年1月31日星期二
2017年1月29日星期日
Simple SAS codes to understand set loop and order duplicated cases.
data try;
input pid value;
datalines;
1 1
1 3
1 5
2 1
2 2
3 1
3 2
3 6
3 8
;
run;
data try2;
set try;
by pid;
episode+1;
if first.pid then episode=1;
run;
input pid value;
datalines;
1 1
1 3
1 5
2 1
2 2
3 1
3 2
3 6
3 8
;
run;
data try2;
set try;
by pid;
episode+1;
if first.pid then episode=1;
run;
2017年1月11日星期三
Spectral decomposition
A<-matrix(c(2,1,1,2),nrow=2,ncol=2)
A
# [,1] [,2]
#[1,] 2 1
#[2,] 1 2
E<-eigen(A)
E
#$values
#[1] 3 1
#$vectors
# [,1] [,2]
#[1,] 0.7071068 -0.7071068
#[2,] 0.7071068 0.7071068
c1<-c(E$vectors[1,1],E$vectors[2,1])
c1
#[1] 0.7071068 0.7071068
c2<-c(E$vectors[1,2],E$vectors[2,2])
c2
#[1] -0.7071068 0.7071068
Q1<-c1%*%t(c1)
Q2<-c2%*%t(c2)
3*Q1+1*Q2
# [,1] [,2]
#[1,] 2 1
#[2,] 1 2
A
# [,1] [,2]
#[1,] 2 1
#[2,] 1 2
E<-eigen(A)
E
#$values
#[1] 3 1
#$vectors
# [,1] [,2]
#[1,] 0.7071068 -0.7071068
#[2,] 0.7071068 0.7071068
c1<-c(E$vectors[1,1],E$vectors[2,1])
c1
#[1] 0.7071068 0.7071068
c2<-c(E$vectors[1,2],E$vectors[2,2])
c2
#[1] -0.7071068 0.7071068
Q1<-c1%*%t(c1)
Q2<-c2%*%t(c2)
3*Q1+1*Q2
# [,1] [,2]
#[1,] 2 1
#[2,] 1 2
订阅:
博文 (Atom)