-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmat.m
58 lines (38 loc) · 842 Bytes
/
smat.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function [S] = smat(v)
s=length(v);
n=((1+8*s)^0.5-1)/2;
% S=zeros(n,n);
k=1;
for i=1:n
for j=i:n
if i==j
S(i,j)=v(k)/2;
else
S(i,j)=1/sqrt(2)*v(k);
end
k=k+1;
end
end
S=S+S';
% if length(v)==1
%
% S=v(1);
%
% end
%
% if length(v)==3
%
% S=[v(1) 1/sqrt(2)*v(2)
% 1/sqrt(2)*v(2) v(3)];
%
% end
%
% if length(v)==10
%
% S=[v(1) 1/sqrt(2)*v(2) 1/sqrt(2)*v(3) 1/sqrt(2)*v(4)
% 1/sqrt(2)*v(2) v(5) 1/sqrt(2)*v(6) 1/sqrt(2)*v(7)
% 1/sqrt(2)*v(3) 1/sqrt(2)*v(6) v(8) 1/sqrt(2)*v(9)
% 1/sqrt(2)*v(4) 1/sqrt(2)*v(7) 1/sqrt(2)*v(9) v(10)];
%
% end
end