From 84c966d1ab14af414491db1f74b395979030b751 Mon Sep 17 00:00:00 2001 From: raj_mathe Date: Sat, 8 Oct 2022 10:25:42 +0200 Subject: [PATCH] main > main: nb - added seed for repeatability, corrected spectral bound --- docs/examples_dilations.ipynb | 56 +++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/examples_dilations.ipynb b/docs/examples_dilations.ipynb index 1a0df70..984fa8e 100644 --- a/docs/examples_dilations.ipynb +++ b/docs/examples_dilations.ipynb @@ -22,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ @@ -37,12 +37,13 @@ "os.chdir(os.path.dirname(_dh[0]));\n", "sys.path.insert(0, os.getcwd());\n", "\n", - "from src.examples_dilations import *;" + "from src.examples_dilations import *;\n", + "np.random.seed(7098123); # for repeatability" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -63,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -75,10 +76,10 @@ "\n", " i spec bound of A_i A_i dissipative (<==> T_i contractive)?\n", "--- ------------------- -----------------------------------------\n", - " 1 -0.465478 True\n", - " 2 -0.465478 True\n", - " 3 -0.465478 True\n", - " 4 -0.465478 True\n" + " 1 -1.000000 True\n", + " 2 -1.000000 True\n", + " 3 -1.000000 True\n", + " 4 -1.000000 True\n" ] } ], @@ -98,7 +99,7 @@ "for i, A_i in enumerate(A):\n", " omega_Re = spec_bounds((1/2)*(A_i + A_i.T.conj()));\n", " omega = spec_bounds(A_i);\n", - " data.append((i+1, omega_Re, True if (omega_Re <= 0) else False));\n", + " data.append((i+1, omega, True if (omega_Re <= 0) else False));\n", "\n", "repr = tabulate(\n", " tabular_data = data,\n", @@ -113,7 +114,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -130,17 +131,17 @@ " [2] 0.465478 True\n", " [1] 0.465478 True\n", " [0] 0.465478 True\n", - " [2, 3] 0.212675 True\n", - " [1, 3] 0.183738 True\n", - " [1, 2] 0.217453 True\n", - " [0, 3] 0.200206 True\n", - " [0, 2] 0.301332 True\n", - " [0, 1] 0.215681 True\n", - " [1, 2, 3] 0.058427 True\n", - " [0, 2, 3] 0.075037 True\n", - " [0, 1, 3] 0.056030 True\n", - " [0, 1, 2] 0.077350 True\n", - "[0, 1, 2, 3] -0.082403 False\n" + " [2, 3] 0.207789 True\n", + " [1, 3] 0.179513 True\n", + " [1, 2] 0.179239 True\n", + " [0, 3] 0.315586 True\n", + " [0, 2] 0.205222 True\n", + " [0, 1] 0.327619 True\n", + " [1, 2, 3] 0.049226 True\n", + " [0, 2, 3] 0.088339 True\n", + " [0, 1, 3] 0.098730 True\n", + " [0, 1, 2] 0.081731 True\n", + "[0, 1, 2, 3] -0.133914 False\n" ] } ], @@ -148,12 +149,11 @@ "# compute the dissipation operators `S_TK` for each `K ⊆ {1,2,...,d}``:\n", "S, beta_T = dissipation_operators(shape=[N, N], A=A);\n", "\n", - "data = [];\n", - "for K, S_TK, b in sorted(S, key=lambda x: len(x[0])):\n", - " data.append((K, b, True if b >= -MACHINE_EPS else False))\n", - "\n", "repr = tabulate(\n", - " tabular_data = data,\n", + " tabular_data = [\n", + " (K, b, True if b >= -MACHINE_EPS else False)\n", + " for K, S_TK, b in sorted(S, key=lambda x: len(x[0]))\n", + " ],\n", " headers = ['K', 'min σ(S_{T,K})', 'S_{T,K} >= 0?'],\n", " showindex = False,\n", " floatfmt = '.6f',\n", @@ -165,7 +165,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -173,7 +173,7 @@ "output_type": "stream", "text": [ "\n", - "β_T = min_K min σ(S_{T,K}) = -0.082403\n", + "β_T = min_K min σ(S_{T,K}) = -0.133914\n", "⟹ T is not compeletely dissipative.\n", "⟹ (by Thm 1.1) T does not have a regular unitary dilation.\n" ]