Last active
December 26, 2015 09:59
-
-
Save traversaro/7133390 to your computer and use it in GitHub Desktop.
Numerical sparse basis for base bla bla bla
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Z_B_2 = [0,0,1,0;0,0,0,1]; | |
X_B_2 = Z_B_2'; | |
P_B_2 = X_B_2*Z_B_2; | |
Z_B_1 = [1,0,0,0;0,1,0,0]; | |
X_B_1 = Z_B_1'; | |
P_B_1 = X_B_1*Z_B_1; | |
Z_I = [1,0,0,0;0,0,1,0;0,sqrt(2)/2,0,sqrt(2)/2]; | |
X_I = Z_I'; | |
P_I = X_I*Z_I; | |
[U,S,V] = svd((P_I*X_B_2)') | |
#some of them | |
Z_A = [0,0,1,0;0,0,0,1]; | |
X_A = Z_A'; | |
P_A = X_A*Z_A; | |
Z_B = [1,0,0,0;0,0,1,0;0,sqrt(2)/2,0,sqrt(2)/2]; | |
X_B = Z_B'; | |
P_B = X_B*Z_B; | |
[U,S,V] = svd(Z_A*P_B) | |
#all of them | |
Z_B = [0,0,1,0;0,0,0,1]; | |
X_B = Z_B'; | |
P_B = X_B*Z_B; | |
Z_A = [1,0,0,0;0,1,0,0;0,0,1,0;]; | |
X_A = Z_A'; | |
P_A = X_A*Z_A; | |
[U,S,V] = svd(Z_A*P_B) | |
Serious stuff now | |
tol = 1e-7; | |
n = 10; | |
n_A = unidrnd(n-1); | |
n_B = unidrnd(n-1); | |
n_C = unidrnd(n-1); | |
X_B = orth(rand(n,n))(:,1:n_B); | |
X_A = orth(rand(n,n))(:,1:n_A); | |
X_C = orth(rand(n,n))(:,1:n_C); | |
Z_C = X_C'; | |
Z_B = X_B'; | |
Z_A = X_A'; | |
P_A = X_A*Z_A; | |
P_B = X_B*Z_B; | |
[U,S,V] = svd((Z_A*P_B)); | |
I = eye(n,n); | |
X_B_intersect_C = null([I-X_B*Z_B;I-X_C*Z_C]); | |
X_A_plus_B_intersect_C = orth([X_A,X_B_intersect_C]) | |
X_A_plus_B = orth([X_A,X_B]); | |
X_A_plus_C = orth([X_A,X_C]); | |
X_A_plus_B_intersect_A_plus_C = null([I-X_A_plus_B*X_A_plus_B';I-X_A_plus_C*X_A_plus_C']) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment