Skip to content

Commit 2488e38

Browse files
lw1660-smsxis10z
authored andcommitted
Release v1.1
1. Amended +qsn/@QSN/bias_sensitivity.m to allow calculation of sensitivity for readout over a given time window 2. Fixed problems caused by matlab's definition of the sinc function (normalized sinc function) by amending target functionals in +qsn/@Control/Control.m 3. Minor bug fixes to optimisation code 4. Added license info and copyright tags 5. Amended README
1 parent 44d7723 commit 2488e38

File tree

127 files changed

+1546
-828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+1546
-828
lines changed

+qsn/@Control/Control.m

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
% [x,err,exec_time,exit_flag,output,x0] = obj.solve_static (opt, x0)
1717
% - solve problem by static controls
1818
%
19+
20+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Frank C Langbein <frank@langbein.org>, Cardiff University
21+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Sophie M Shermer <lw1660@gmail.com>, Swansea University
22+
% SPDX-License-Identifier: AGPL-3.0-or-later
23+
1924
properties (SetAccess = private)
2025
system = 'undef'; % QSN object
2126
problem = struct ('type', 'undef'); % Control problem description
@@ -144,7 +149,7 @@
144149
N = length(E);
145150
L = ones(N,1)*E.'-E*ones(1,N);
146151
W = (out'*V).*(V'*in)';
147-
pp = 1-real(W*(exp(1i*L*T).*sinc(L*obj.problem.dt/2))*W');
152+
pp = 1-real(W*(exp(1i*L*T).*sinc(L*obj.problem.dt/(2*pi)))*W');
148153
prob = prob + pp;
149154
ppp(rep) = pp;
150155
end
@@ -423,7 +428,7 @@ function disp (obj)
423428
N = length(E);
424429
L = ones(N,1)*E.'-E*ones(1,N);
425430
W = (out'*V).*(V'*in)';
426-
prob = 1-real(W*(exp(1i*L*T).*sinc(L*obj.problem.dt/2))*W');
431+
prob = 1-real(W*(exp(1i*L*T).*sinc(L*obj.problem.dt/(2*pi)))*W');
427432
err = prob;
428433
grad = [];
429434
end
@@ -461,7 +466,7 @@ function disp (obj)
461466
N = length(E);
462467
L = ones(N,1)*E.'-E*ones(1,N);
463468
W = (out'*V).*(V'*in)';
464-
pp = 1-real(W*(exp(1i*L*T).*sinc(L*obj.problem.dt/2))*W');
469+
pp = 1-real(W*(exp(1i*L*T).*sinc(L*obj.problem.dt/(2*pi)))*W');
465470
prob = prob + pp;
466471
end
467472
prob = prob / obj.problem.samples;
@@ -506,4 +511,4 @@ function disp (obj)
506511
end
507512
end
508513
end
509-
end
514+
end

+qsn/@Control/private/dexpma.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
% [F,dF] = dexpma(M,dM,v)
33
%
44
% Gradient helper for eal_static_st
5+
6+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Frank C Langbein <frank@langbein.org>, Cardiff University
7+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Sophie M Shermer <lw1660@gmail.com>, Swansea University
8+
% SPDX-License-Identifier: AGPL-3.0-or-later
9+
510
N = length(M);
611
AM = [M zeros(N);dM M];
712
if exist('v','var')

+qsn/@DS/DS.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@
3434
%
3535
% obj . plot_graph (type, scale, violations)
3636
% - Plot distances as graph
37-
%
37+
38+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Frank C Langbein <frank@langbein.org>, Cardiff University
39+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Sophie M Shermer <lw1660@gmail.com>, Swansea University
40+
% SPDX-License-Identifier: AGPL-3.0-or-later
41+
3842
properties (SetAccess = private)
3943
N = NaN; % Number of nodes
4044
D = NaN; % Distance matrix

+qsn/@DS/plot_graph.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ function plot_graph(obj, type, scale,violations)
66
% type - Mode of graph construction: 'fdp' or 'neato'
77
% scale - Graph scale
88
% violations - Only print triangle violations
9-
%
9+
10+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Frank C Langbein <frank@langbein.org>, Cardiff University
11+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Sophie M Shermer <lw1660@gmail.com>, Swansea University
12+
% SPDX-License-Identifier: AGPL-3.0-or-later
1013

1114
S = obj.D >= obj.eps;
1215
D = (obj.D * S + 1) * scale;

+qsn/@DS/private/BellmanFord.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
% N is the next node; specifically, N(v) is the next node from source
2222
% node s in the minimum path from source node s to destination node v.
2323
%
24+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019 Edmond Jonckheere, University of Southern California
25+
% SPDX-License-Identifier: AGPL-3.0-or-later
2426

2527
% Initialization
2628
Numnode = size(w,1);
@@ -53,4 +55,4 @@
5355
end
5456
end
5557

56-
end
58+
end

+qsn/@DS/private/Dijkstra.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
% N is the next node; specifically, N(v) is the next node from source node s
1717
% in the minimum path from source node s to destination node v.
1818
%
19+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019 Edmond Jonckheere, University of Southern California
20+
% SPDX-License-Identifier: AGPL-3.0-or-later
1921

2022
% Initialization
2123
Numnode = size(w,1);
@@ -61,4 +63,4 @@
6163

6264
end
6365

64-
end
66+
end

+qsn/@DS/private/fix_triangle_violations_isoceles.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
% DD - Resulting distance matrix
1313
%
1414

15+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Frank C Langbein <frank@langbein.org>, Cardiff University
16+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Sophie M Shermer <lw1660@gmail.com>, Swansea University
17+
% SPDX-License-Identifier: AGPL-3.0-or-later
18+
1519
if show ~= 0
1620
D0 = D;
1721
end
@@ -95,4 +99,4 @@
9599

96100
end
97101

98-
end
102+
end

+qsn/@DS/private/fix_triangle_violations_mincon.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
% DD - Resulting distance matrix
1818
%
1919

20+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Frank C Langbein <frank@langbein.org>, Cardiff University
21+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Sophie M Shermer <lw1660@gmail.com>, Swansea University
22+
% SPDX-License-Identifier: AGPL-3.0-or-later
23+
2024
n = size(D,1);
2125

2226
S = (n * n - n) / 2;

+qsn/@DS/private/fix_triangle_violations_minuncon.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
% mode = [N,1] - L_N norm with scaling factor
1212
% show - If true, verbose mode
1313
% DD - Resulting distance matrix
14-
%
14+
15+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Frank C Langbein <frank@langbein.org>, Cardiff University
16+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Sophie M Shermer <lw1660@gmail.com>, Swansea University
17+
% SPDX-License-Identifier: AGPL-3.0-or-later
1518

1619
n = size(D,1);
1720

+qsn/@DS/private/fix_triangle_violations_straight.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
% DD - Resulting distance matrix
1111
%
1212

13+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Frank C Langbein <frank@langbein.org>, Cardiff University
14+
% SPDX-FileCopyrightText: Copyright (C) 2011-2019, 2022 Sophie M Shermer <lw1660@gmail.com>, Swansea University
15+
% SPDX-License-Identifier: AGPL-3.0-or-later
16+
1317
if show ~= 0
1418
D0 = D;
1519
end

0 commit comments

Comments
 (0)