aboutsummaryrefslogtreecommitdiff
path: root/williamson.m
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2024-11-20 21:27:21 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2024-11-20 21:27:21 -0500
commitba1aa48aa9f0a5daab3619812733e67c4babf9db (patch)
treee4086a7d863d635c91c6bc4be89dd4edc7a85e46 /williamson.m
parentfa3ed5eaf67bd54e8f1fa4a1bc2c7ffbd1898d6f (diff)
downloadmatlab_strawberryfields-ba1aa48aa9f0a5daab3619812733e67c4babf9db.tar.gz
matlab_strawberryfields-ba1aa48aa9f0a5daab3619812733e67c4babf9db.zip
added test cases for bloch_messiah and williamson
Diffstat (limited to 'williamson.m')
-rw-r--r--williamson.m11
1 files changed, 10 insertions, 1 deletions
diff --git a/williamson.m b/williamson.m
index f969ab1..eaba514 100644
--- a/williamson.m
+++ b/williamson.m
@@ -57,7 +57,6 @@ function [Db, S] = williamson(V, tol)
Kt = K * p;
s1t = p * s1 * p;
- s1t
dd = xpxp_to_xxpp(s1t);
perm_indices = xpxp_to_xxpp(1:2*n);
@@ -70,4 +69,14 @@ function [Db, S] = williamson(V, tol)
S = inv(S)';
end
+%!test
+%! V = load('test_data/covmat0.csv');
+%! [Db, S] = williamson(V);
+%! assert(Db,eye(8), 1e-14)
+
+%!test
+%! V = load('test_data/covmat15.csv');
+%! D0 = load('test_data/w_diag15.csv');
+%! [Db, S] = williamson(V);
+%! assert(Db,D0, 1e-9)