Skip to content

Commit

Permalink
A type corrected / now presented for order 17
Browse files Browse the repository at this point in the history
  • Loading branch information
ipgmvq authored Apr 23, 2021
1 parent 3628307 commit f9bd582
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 29 deletions.
20 changes: 9 additions & 11 deletions latin_square_cyclicity_check.html
Original file line number Diff line number Diff line change
Expand Up @@ -14279,7 +14279,7 @@ <h3 id="Please-be-warned-that-the-script-is-sensitive-to-the-newline-symbols-(an
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs ">
<div class="jp-Cell-inputWrapper">
<div class="jp-InputArea jp-Cell-inputArea">
<div class="jp-InputPrompt jp-InputArea-prompt">In&nbsp;[6]:</div>
<div class="jp-InputPrompt jp-InputArea-prompt">In&nbsp;[2]:</div>
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
<div class="CodeMirror cm-s-jupyter">
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
Expand All @@ -14294,7 +14294,7 @@ <h3 id="Please-be-warned-that-the-script-is-sensitive-to-the-newline-symbols-(an
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell jp-mod-noOutputs ">
<div class="jp-Cell-inputWrapper">
<div class="jp-InputArea jp-Cell-inputArea">
<div class="jp-InputPrompt jp-InputArea-prompt">In&nbsp;[19]:</div>
<div class="jp-InputPrompt jp-InputArea-prompt">In&nbsp;[3]:</div>
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
<div class="CodeMirror cm-s-jupyter">
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">pandiagonal</span><span class="p">(</span><span class="n">matrix</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">,</span> <span class="n">order</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
Expand Down Expand Up @@ -14389,7 +14389,7 @@ <h3 id="Please-be-warned-that-the-script-is-sensitive-to-the-newline-symbols-(an
</div><div class="jp-Cell jp-CodeCell jp-Notebook-cell ">
<div class="jp-Cell-inputWrapper">
<div class="jp-InputArea jp-Cell-inputArea">
<div class="jp-InputPrompt jp-InputArea-prompt">In&nbsp;[25]:</div>
<div class="jp-InputPrompt jp-InputArea-prompt">In&nbsp;[5]:</div>
<div class="jp-CodeMirrorEditor jp-Editor jp-InputArea-editor" data-type="inline">
<div class="CodeMirror cm-s-jupyter">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">squares</span> <span class="o">=</span> <span class="nb">list</span><span class="p">()</span>
Expand All @@ -14398,7 +14398,7 @@ <h3 id="Please-be-warned-that-the-script-is-sensitive-to-the-newline-symbols-(an

<span class="n">order</span> <span class="o">=</span> <span class="kc">None</span>

<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s1">&#39;semi_cyclic_pandiagonal_latin_squares_order_13.txt&#39;</span><span class="p">,</span> <span class="s1">&#39;r&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s1">&#39;semi_cyclic_pandiagonal_latin_squares_order_17.txt&#39;</span><span class="p">,</span> <span class="s1">&#39;r&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">f</span><span class="o">.</span><span class="n">readlines</span><span class="p">():</span>
<span class="k">if</span> <span class="n">line</span><span class="o">.</span><span class="n">split</span><span class="p">():</span>
<span class="k">if</span> <span class="n">order</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
Expand All @@ -14418,7 +14418,7 @@ <h3 id="Please-be-warned-that-the-script-is-sensitive-to-the-newline-symbols-(an


<span class="n">result</span> <span class="o">=</span> <span class="n">cyclicity_list</span><span class="p">(</span><span class="n">squares</span><span class="p">,</span> <span class="n">order</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;</span><span class="si">%d</span><span class="s1"> sqaures were read&#39;</span> <span class="o">%</span> <span class="n">count</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">&#39;</span><span class="si">%d</span><span class="s1"> squares were read&#39;</span> <span class="o">%</span> <span class="n">count</span><span class="p">)</span>



Expand Down Expand Up @@ -14459,12 +14459,10 @@ <h3 id="Please-be-warned-that-the-script-is-sensitive-to-the-newline-symbols-(an

<div class="jp-RenderedText jp-OutputArea-output" data-mime-type="text/plain">
<pre>There are 0 non-pandiagonal squares in the dataset
1362 sqaures were read
338 squares are cyclic in a horizontal direction
338 squares are cyclic in a main-diagonal direction
338 squares are cyclic in a vertical direction
338 squares are cyclic in a antidiagonal direction
10 squares are cyclic in all four directions
16538 squares were read
8262 squares are cyclic in a horizontal direction
8262 squares are cyclic in a vertical direction
14 squares are cyclic in all four directions
</pre>
</div>
</div>
Expand Down
27 changes: 9 additions & 18 deletions latin_square_cyclicity_check.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -40,7 +40,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -130,20 +130,18 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"There are 0 non-pandiagonal squares in the dataset\n",
"1362 sqaures were read\n",
"338 squares are cyclic in a horizontal direction\n",
"338 squares are cyclic in a main-diagonal direction\n",
"338 squares are cyclic in a vertical direction\n",
"338 squares are cyclic in a antidiagonal direction\n",
"10 squares are cyclic in all four directions\n"
"16538 squares were read\n",
"8262 squares are cyclic in a horizontal direction\n",
"8262 squares are cyclic in a vertical direction\n",
"14 squares are cyclic in all four directions\n"
]
}
],
Expand All @@ -154,7 +152,7 @@
"\n",
"order = None\n",
"\n",
"with open('semi_cyclic_pandiagonal_latin_squares_order_13.txt', 'r') as f:\n",
"with open('semi_cyclic_pandiagonal_latin_squares_order_17.txt', 'r') as f:\n",
" for line in f.readlines():\n",
" if line.split():\n",
" if order is None:\n",
Expand All @@ -174,7 +172,7 @@
"\n",
"\n",
"result = cyclicity_list(squares, order)\n",
"print('%d sqaures were read' % count)\n",
"print('%d squares were read' % count)\n",
"\n",
"\n",
"\n",
Expand All @@ -197,13 +195,6 @@
" \n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit f9bd582

Please sign in to comment.