From 24f4329e48609778fbca5205777b0be1f62c2904 Mon Sep 17 00:00:00 2001 From: Berry Schoenmakers Date: Mon, 21 Oct 2024 10:58:59 +0200 Subject: [PATCH] Fix disabling PRSS. --- demos/PrefixOrExplained.ipynb | 7 ++++--- demos/PrefixOrExplained.py | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/demos/PrefixOrExplained.ipynb b/demos/PrefixOrExplained.ipynb index dd99b4c..79f60c1 100644 --- a/demos/PrefixOrExplained.ipynb +++ b/demos/PrefixOrExplained.ipynb @@ -18,7 +18,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "2024-10-08 16:31:45,984 Start MPyC runtime v0.10.3\n" + "2024-10-21 10:53:07,251 Start MPyC runtime v0.10.3\n" ] } ], @@ -444,9 +444,10 @@ } ], "source": [ + "no_prss = mpc.options.no_prss\n", "mpc.options.no_prss = True # disable PRSS temporarily\n", "complexity(prefix_or1, 32)\n", - "mpc.options.no_prss = False # back to default" + "mpc.options.no_prss = no_prss" ] }, { @@ -1004,7 +1005,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "2024-10-08 16:31:47,297 Stop MPyC -- elapsed time: 0:00:01.311|bytes sent: 0\n" + "2024-10-21 10:53:09,859 Stop MPyC -- elapsed time: 0:00:02.607|bytes sent: 0\n" ] } ], diff --git a/demos/PrefixOrExplained.py b/demos/PrefixOrExplained.py index 795e838..e2bf35f 100644 --- a/demos/PrefixOrExplained.py +++ b/demos/PrefixOrExplained.py @@ -202,9 +202,10 @@ def prefix_or2(x): # In[13]: +no_prss = mpc.options.no_prss mpc.options.no_prss = True # disable PRSS temporarily complexity(prefix_or1, 32) -mpc.options.no_prss = False # back to default +mpc.options.no_prss = no_prss # The or-complexity is now reduced to $2n-2-\log_2 n$ for inputs of length $n=2^k$. The trade-off is that the or-depth increases by almost a factor of 2, as it becomes $2\log_2 n -2$. The underlying method due to Brent–Kung is explained in Section 3.