-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_networks.m
140 lines (116 loc) · 3.74 KB
/
example_networks.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
function example_networks
% QSN package example
%
% Analyse geometry of a quantum spin chains and rings to demonstrate
% basic usage of qsn.QSN and qsn.DS classes.
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Frank C Langbein <frank@langbein.org>, Cardiff University
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 SM Shermer <lw1660@gmail.com>, Swansea University
% SPDX-License-Identifier: AGPL-3.0-or-later
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Construct chain and display
disp('=======================================================================');
disp('Constructing an XX chain of length 5');
chain = qsn.QSN('chain', 5)
key ();
% Chain figure
disp('Plotting information about chain');
figure(1);
clf;
chain.plot ();
key ();
% Estimate maximal probability within time interval
disp ('Estimating probabilities attained between 0 and 10');
[prob_max,time] = chain.prob_max (0, 10, 5, 6, 1)
key ();
% Plot dynamics of chain
clf;
disp ('Plotting dynamics of chain from 0 to 10');
chain.plot_dynamics(.5, 0:.05:10);
key ();
disp ('Plotting ddynamics of chain from 0 to 10 for node 1');
chain.plot_dynamics(.5, 0:.05:10, -1);
key ();
% Construct distance space
disp ('Construct distances from probabilities');
dist = qsn.DS(chain)
dist.plot ();
key ();
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Construct engineered chain and display
disp('=======================================================================');
disp('Constructing an engineered Heisenberg chain of length 5');
chain = qsn.QSN('chain', 5, 'H', [ 0 0 1000 0 0 ])
key ();
% Chain figure
disp('Plotting information about chain');
figure(1);
clf;
chain.plot ();
key ();
% Construct distance space
disp ('Construct distances from probabilities');
dist = qsn.DS(chain)
dist.plot ();
key ();
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Construct ring and display
disp('=======================================================================');
disp('Constructing an XX ring of length 5');
ring = qsn.QSN('ring', 5)
key ();
% Chain figure
disp('Plotting information about ring');
figure(1);
clf;
ring.plot ();
key ();
% Estimate maximal probability within time interval
disp ('Estimating probabilities attained between 0 and 10');
[prob_max,time] = ring.prob_max (0, 10, 5, 6, 1)
key ();
% Plot dynamics of ring
clf;
disp ('Plotting dynamics of ring from 0 to 10');
ring.plot_dynamics(.5, 0:.05:10);
key ();
disp ('Plotting ddynamics of ring from 0 to 10 for node 1');
ring.plot_dynamics(.5, 0:.05:10, -1);
key ();
% Construct distance space
disp ('Construct distances from probabilities');
dist = qsn.DS(ring)
dist.plot ();
key ();
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Construct engineered ring and display
disp('=======================================================================');
disp('Constructing an engineered Heisenberg ring of length 13');
ring = qsn.QSN('ring', 13, 'H', [0 0 0 0 0 0 1000 0 0 0 0 0 0])
key ();
% Chain figure
disp('Plotting information about ring');
figure(1);
clf;
ring.plot ();
key ();
% Construct distance space
disp ('Construct distances from probabilities');
dist = qsn.DS(ring)
dist.plot ();
key ();
disp ('Checking metric:');
dist.check_metric (true);
key ();
disp ('Fixing metric:');
M = dist.generate_metric ('mean', 'mean', 'isoceles', @(x) mean(x), true);
key ();
disp ('Displaying resulting metric:')
disp(M);
M.plot ();
M.check_metric (true);
key ();
function key ()
disp('Press key to continue');
pause;
end
end