Skip to content

Commit

Permalink
Update to v0.1-16-gf04f0aa
Browse files Browse the repository at this point in the history
  • Loading branch information
zydd committed Feb 3, 2024
1 parent 7eaf3e7 commit a54ce54
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 17 deletions.
4 changes: 2 additions & 2 deletions _sources/benchmark.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Encoding
**libffrs** `v0.1-11-g5bf2eb3 <https://github.com/zydd/libffrs/tree/v0.1>`_


`ffrs.RS256.encode_blocks <generated/ffrs.RS256.html#ffrs.RS256.encode_blocks>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:py:meth:`ffrs.RS256.encode_blocks`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. csv-table::
:file: benchmark_encode_blocks.csv
Expand Down
5 changes: 4 additions & 1 deletion _sources/generated/ffrs.RS256.rst.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ffrs.RS256
ffrs.RS256
==========


Expand Down Expand Up @@ -30,8 +30,11 @@ ffrs.RS256

.. autosummary::

~RS256.default_block_len
~RS256.default_block_msg_len
~RS256.ecc_len
~RS256.generator
~RS256.generator_roots
~RS256.gf


6 changes: 3 additions & 3 deletions benchmark.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@
<section id="encoding">
<h2>Encoding<a class="headerlink" href="#encoding" title="Link to this heading">#</a></h2>
<p><strong>libffrs</strong> <a class="reference external" href="https://github.com/zydd/libffrs/tree/v0.1">v0.1-11-g5bf2eb3</a></p>
<section id="id2">
<h3><a class="reference external" href="generated/ffrs.RS256.html#ffrs.RS256.encode_blocks">ffrs.RS256.encode_blocks</a><a class="headerlink" href="#id2" title="Link to this heading">#</a></h3>
<section id="ffrs-rs256-encode-blocks">
<h3><a class="reference internal" href="generated/ffrs.RS256.html#ffrs.RS256.encode_blocks" title="ffrs.RS256.encode_blocks"><code class="xref py py-meth docutils literal notranslate"><span class="pre">ffrs.RS256.encode_blocks()</span></code></a><a class="headerlink" href="#ffrs-rs256-encode-blocks" title="Link to this heading">#</a></h3>
<div class="table-wrapper docutils container">
<table class="docutils align-default">
<tbody>
Expand Down Expand Up @@ -390,7 +390,7 @@ <h3>System specs<a class="headerlink" href="#system-specs" title="Link to this h
<ul>
<li><a class="reference internal" href="#">Benchmarks</a><ul>
<li><a class="reference internal" href="#encoding">Encoding</a><ul>
<li><a class="reference internal" href="#id2">ffrs.RS256.encode_blocks</a></li>
<li><a class="reference internal" href="#ffrs-rs256-encode-blocks"><code class="xref py py-meth docutils literal notranslate"><span class="pre">ffrs.RS256.encode_blocks()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#decoding">Decoding</a></li>
Expand Down
2 changes: 1 addition & 1 deletion front.html
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
<h1>libffrs<a class="headerlink" href="#libffrs" title="Link to this heading">#</a></h1>
<p>Fairly <em>F</em>ast &amp; <em>F</em>lexible <em>R</em>eed-<em>S</em>olomon Coding</p>
<p>This library uses a variation Intel’s Slicing-by-8 algorithm for the encoding routines,
achieving some hefty encoding speeds depending on the code sizes. See <a class="reference internal" href="benchmark.html#benchmarks"><span class="std std-ref">Benchmarks</span></a>.</p>
achieving some hefty speeds depending on the code sizes. See <a class="reference external" href="https://zydd.github.io/libffrs/benchmark.html">Benchmarks</a>.</p>
<p>The core implementation is done in C++ and exported to Python with <a class="reference external" href="https://github.com/pybind/pybind11">pybind11</a>.</p>
</section>
<section id="basic-usage">
Expand Down
4 changes: 1 addition & 3 deletions generated/ffrs.GF256.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,11 @@ <h1>ffrs.GF256<a class="headerlink" href="#ffrs-gf256" title="Link to this headi
</div>
<dl class="py method">
<dt class="sig sig-object py" id="ffrs.GF256.__init__">
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#ffrs.GF256" title="ffrs.GF256"><span class="pre">ffrs.GF256</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">prime</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">power</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">8</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">primitive</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">poly1</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">29</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#ffrs.GF256.__init__" title="Link to this definition">#</a></dt>
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#ffrs.GF256" title="ffrs.GF256"><span class="pre">ffrs.GF256</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">primitive</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">poly1</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">285</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#ffrs.GF256.__init__" title="Link to this definition">#</a></dt>
<dd><p>Instantiate type for operations over <span class="math notranslate nohighlight">\(GF(p^n)/P\)</span></p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>prime</strong><span class="math notranslate nohighlight">\(p\)</span> – always 2</p></li>
<li><p><strong>power</strong><span class="math notranslate nohighlight">\(n\)</span> – always 8</p></li>
<li><p><strong>primitive</strong><span class="math notranslate nohighlight">\(a\)</span> – primitive value used to generate the field</p></li>
<li><p><strong>polynomial</strong><span class="math notranslate nohighlight">\(P\)</span> – irreducible polynomial used to generate the field</p></li>
</ul>
Expand Down
56 changes: 51 additions & 5 deletions generated/ffrs.RS256.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ <h1>ffrs.RS256<a class="headerlink" href="#ffrs-rs256" title="Link to this headi
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#ffrs.RS256.__init__" title="ffrs.RS256.__init__"><code class="xref py py-obj docutils literal notranslate"><span class="pre">__init__</span></code></a></p></td>
<td><p></p></td>
<td><p>Instantiate a Reed-Solomon encoder with the given configuration</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#ffrs.RS256.decode" title="ffrs.RS256.decode"><code class="xref py py-obj docutils literal notranslate"><span class="pre">decode</span></code></a></p></td>
<td><p>Systematic decode</p></td>
Expand All @@ -237,22 +237,63 @@ <h1>ffrs.RS256<a class="headerlink" href="#ffrs-rs256" title="Link to this headi
<div class="table-wrapper autosummary longtable docutils container">
<table class="autosummary longtable docutils align-default">
<tbody>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">default_block_len</span></code></p></td>
<td><p></p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">default_block_msg_len</span></code></p></td>
<td><p></p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">ecc_len</span></code></p></td>
<td><p></p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">generator</span></code></p></td>
<td><p></p></td>
</tr>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">gf</span></code></p></td>
<tr class="row-odd"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">generator_roots</span></code></p></td>
<td><p></p></td>
</tr>
<tr class="row-even"><td><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">gf</span></code></p></td>
<td><p></p></td>
</tr>
</tbody>
</table>
</div>
<dl class="py method">
<dt class="sig sig-object py" id="ffrs.RS256.__init__">
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#ffrs.RS256" title="ffrs.RS256"><span class="pre">ffrs.RS256</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">ecc_len</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#ffrs.RS256.__init__" title="Link to this definition">#</a></dt>
<dd></dd></dl>
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#ffrs.RS256" title="ffrs.RS256"><span class="pre">ffrs.RS256</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">block_len</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">message_len</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ecc_len</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">primitive</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">polynomial</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">285</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#ffrs.RS256.__init__" title="Link to this definition">#</a></dt>
<dd><p>Instantiate a Reed-Solomon encoder with the given configuration</p>
<p class="rubric">Example</p>
<dl>
<dt><code class="docutils literal notranslate"><span class="pre">RS256(255,</span> <span class="pre">223)</span></code></dt><dd><p>Equivalent to <code class="docutils literal notranslate"><span class="pre">RS256(ecc_len=32)</span></code></p>
<p>Creates an encoder for 32 bytes of parity, capable of correcting up to 16 errors in a 255-byte block</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>block_len</strong><div class="line-block">
<div class="line"><span class="math notranslate nohighlight">\(n\)</span> – default block size used by <a class="reference internal" href="#ffrs.RS256.encode_blocks" title="ffrs.RS256.encode_blocks"><code class="xref py py-meth docutils literal notranslate"><span class="pre">encode_blocks()</span></code></a></div>
<div class="line"><code class="docutils literal notranslate"><span class="pre">block_len</span> <span class="pre">=</span> <span class="pre">message_len</span> <span class="pre">+</span> <span class="pre">ecc_len</span></code></div>
</div>
</p></li>
<li><p><strong>message_len</strong><div class="line-block">
<div class="line"><span class="math notranslate nohighlight">\(k\)</span> – number of actual data bytes in a block</div>
<div class="line">Can be omitted if <code class="docutils literal notranslate"><span class="pre">ecc_len</span></code> is supplied</div>
</div>
</p></li>
<li><p><strong>ecc_len</strong><div class="line-block">
<div class="line"><span class="math notranslate nohighlight">\((n - k)\)</span> – number of parity bytes in a block</div>
<div class="line-block">
<div class="line">Can be omitted if <code class="docutils literal notranslate"><span class="pre">message_len</span></code> is supplied</div>
</div>
</div>
</p></li>
<li><p><strong>primitive</strong><span class="math notranslate nohighlight">\(a\)</span> – primitive value for <a class="reference internal" href="ffrs.GF256.html#ffrs.GF256" title="ffrs.GF256"><code class="xref py py-class docutils literal notranslate"><span class="pre">GF256</span></code></a></p></li>
<li><p><strong>polynomial</strong><span class="math notranslate nohighlight">\(P\)</span> – irreducible polynomial for <a class="reference internal" href="ffrs.GF256.html#ffrs.GF256" title="ffrs.GF256"><code class="xref py py-class docutils literal notranslate"><span class="pre">GF256</span></code></a></p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="ffrs.RS256.decode">
Expand All @@ -268,8 +309,13 @@ <h1>ffrs.RS256<a class="headerlink" href="#ffrs-rs256" title="Link to this headi

<dl class="py method">
<dt class="sig sig-object py" id="ffrs.RS256.encode_blocks">
<span class="sig-name descname"><span class="pre">encode_blocks</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#ffrs.RS256" title="ffrs.RS256"><span class="pre">ffrs.RS256</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">buffer</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Buffer</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">input_block_size</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bytearray</span></span></span><a class="headerlink" href="#ffrs.RS256.encode_blocks" title="Link to this definition">#</a></dt>
<span class="sig-name descname"><span class="pre">encode_blocks</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#ffrs.RS256" title="ffrs.RS256"><span class="pre">ffrs.RS256</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">buffer</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Buffer</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">block_len</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bytearray</span></span></span><a class="headerlink" href="#ffrs.RS256.encode_blocks" title="Link to this definition">#</a></dt>
<dd><p>Encode blocks</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The size of <code class="docutils literal notranslate"><span class="pre">buffer</span></code> should be a multiple of <code class="xref py py-attr docutils literal notranslate"><span class="pre">RS256.default_block_msg_len</span></code>
to allow concatenating the results of multiple calls to <a class="reference internal" href="#ffrs.RS256.encode_blocks" title="ffrs.RS256.encode_blocks"><code class="xref py py-meth docutils literal notranslate"><span class="pre">encode_blocks()</span></code></a>.</p>
</div>
</dd></dl>

</dd></dl>
Expand Down
Loading

0 comments on commit a54ce54

Please sign in to comment.