Skip to content

Commit

Permalink
Docstring fixes, updated table of supported builds. Should be a relea…
Browse files Browse the repository at this point in the history
…se build
  • Loading branch information
peekxc committed Dec 29, 2023
1 parent 1b4ee24 commit 2e1e334
Show file tree
Hide file tree
Showing 32 changed files with 786 additions and 1,234 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@

[![](https://img.shields.io/badge/docs-quarto-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEMAAABDCAMAAADwFEhBAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAB2lBMVEUAAABxvP90vP9zu/90u/90u/90u/90u/91uv91vP9zuv91v/91uv91u/9zvP90u/90uv92uv+As/91u/91u/90u/90u/90vP+Aqv90u/91u/9zuv90uf90u/90u/90u/9zuf9ttv90u/90u/91vP8A//92uv90u/95tv9zuv90u/90vP9zuv90u/91uv91u/90u/90vP90uf9zvP90u/93vv90u/90u/93u/9qv/90u/9zu/91vP90u/90vP95vP9Vqv90u/90u/91u/90u/90uf+Av/91u/90u/9xvf90u/91vP92vv90u/+AgP90u/9zu/91vP9vvP90u/90uv90u/94tP90u/9zvP90uv90u/90u/91u/90vP9zu/90uv91u/90uv9zvP9zuv9xu/9zvP90u/90u/90vP9zvP90uf9xxv90u/90uv90u/9zvf90u/90u/90u/90uv91uv90vP90uf90u/91vP90u/9wuP9zu/9zvP9zuv90u/92v/90uv90vP9yvP90uv90u/9mzP91u/90vP90u/92vP90vP9zvP90u/90u/90u/90u/9yuv91uv90u/91vP91u/90u/90u/9zu/91vf90u/90u/91u/90u//////Zz6urAAAAnHRSTlMAImOdxOv+4LqQWRgwjt/NdxoKadL8uUQGcOjJTUvbvygOpfh2ATTaFV3kLnPvP4P3ckJb8Cv12Q8M16ibWjkTA8+VYvshBJdWG8OBJ+ICfzyMF9FR/RGERauW9LHBvqfHhp9vLTWwqW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9wcdU/RAwxAPnXOW7FA3Ho3fxOhjVaPPmDCsT56qGc8yLuv8PKBivCh3nfjBbnlj6KXHd6LllaQReu39VxjpD8sYb96SX0rfFTdqo+Sf5PsP/kbwIxVPa90nb+Pzl4gEYaZq+GvWzYgnvskBdtLtI9+dxo/Ez4yKYOdXz+8/Q9bFSNnfVFr9fpX8A/gO4x9ExakgAAAAUGVYSWZNTQAqAAAACAACARIAAwAAAAEAAQAAh2kABAAAAAEAAAAmAAAAAAADoAEAAwAAAAEAAQAAoAIABAAAAAEAAABDoAMABAAAAAEAAABDAAAAAEC2TfoAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjMtMDgtMjJUMDI6MDg6MTgrMDA6MDDjF9jVAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIzLTA4LTIyVDAyOjA4OjE4KzAwOjAwkkpgaQAAACh0RVh0ZGF0ZTp0aW1lc3RhbXAAMjAyMy0wOC0yMlQwMjowODoxOSswMDowMGMoSgIAAAARdEVYdGV4aWY6Q29sb3JTcGFjZQAxD5sCSQAAABJ0RVh0ZXhpZjpFeGlmT2Zmc2V0ADM4rbi+IwAAABd0RVh0ZXhpZjpQaXhlbFhEaW1lbnNpb24ANjeFsWfdAAAAF3RFWHRleGlmOlBpeGVsWURpbWVuc2lvbgA2N1gnvlgAAAASdEVYdHRpZmY6T3JpZW50YXRpb24AMber/DsAAAAASUVORK5CYII=)](https://peekxc.github.io/primate/)
<!-- [![coverage_badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/peekxc/ef42349965f40edf4232737026690c5f/raw/coverage_info.json)](https://coveralls.io/github/peekxc/simplextree-py) -->
[![build_macos](https://img.shields.io/github/actions/workflow/status/peekxc/primate/build_macos.yml?logo=apple&logoColor=white)](https://github.com/peekxc/primate/actions/workflows/build_macos.yml)
[![build_windows](https://img.shields.io/github/actions/workflow/status/peekxc/primate/build_windows.yml?logo=windows&logoColor=white)](https://github.com/peekxc/primate/actions/workflows/build_windows.yml)
[![build_linux](https://img.shields.io/github/actions/workflow/status/peekxc/primate/build_linux.yml?logo=linux&logoColor=white)](https://github.com/peekxc/primate/actions/workflows/build_linux.yml)
<!-- [![PyPI Version](https://img.shields.io/pypi/v/simplextree)](https://pypi.org/project/simplextree) -->
[![Python versions](https://img.shields.io/badge/python-%E2%89%A5%203.8-blue.svg)](https://github.com/peekxc/primate/actions)


`primate`, short for **Pr**obabalistic **I**mplicit **Ma**trix **T**race **E**stimator, is a Python package that provides estimators of quantities derived from [matrix functions](https://en.wikipedia.org/wiki/Analytic_function_of_a_matrix); that is, matrices parameterized by functions:

$$ f(A) \triangleq U f(\Lambda) U^{\intercal}, \quad \quad f : [a,b] \to \mathbb{R}$$
Expand Down
14 changes: 7 additions & 7 deletions docs/advanced/cpp_integration.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<script src="../site_libs/quarto-search/quarto-search.js"></script>
<meta name="quarto:offset" content="../">
<link href="../advanced/pybind11_integration.html" rel="next">
<link href="../theory/matrix_functions.html" rel="prev">
<link href="../theory/lanczos.html" rel="prev">
<script src="../site_libs/quarto-html/quarto.js"></script>
<script src="../site_libs/quarto-html/popper.min.js"></script>
<script src="../site_libs/quarto-html/tippy.umd.min.js"></script>
Expand Down Expand Up @@ -228,14 +228,14 @@
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../theory/lanczos.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">The Lanczos Method</span></a>
<a href="../theory/matrix_functions.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Matrix functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../theory/matrix_functions.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Matrix functions</span></a>
<a href="../theory/lanczos.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">The Lanczos Method</span></a>
</div>
</li>
</ul>
Expand Down Expand Up @@ -984,8 +984,8 @@ <h2 class="anchored" data-anchor-id="other-concepts">Other Concepts</h2>
</script>
<nav class="page-navigation">
<div class="nav-page nav-page-previous">
<a href="../theory/matrix_functions.html" class="pagination-link aria-label=" matrix="" functions"="">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text">Matrix functions</span>
<a href="../theory/lanczos.html" class="pagination-link aria-label=" the="" lanczos="" method"="">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text">The Lanczos Method</span>
</a>
</div>
<div class="nav-page nav-page-next">
Expand Down
8 changes: 4 additions & 4 deletions docs/advanced/pybind11_integration.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../theory/lanczos.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">The Lanczos Method</span></a>
<a href="../theory/matrix_functions.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Matrix functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../theory/matrix_functions.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Matrix functions</span></a>
<a href="../theory/lanczos.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">The Lanczos Method</span></a>
</div>
</li>
</ul>
Expand Down
8 changes: 4 additions & 4 deletions docs/advanced/slq_param.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../theory/lanczos.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">The Lanczos Method</span></a>
<a href="../theory/matrix_functions.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Matrix functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../theory/matrix_functions.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Matrix functions</span></a>
<a href="../theory/lanczos.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">The Lanczos Method</span></a>
</div>
</li>
</ul>
Expand Down
67 changes: 63 additions & 4 deletions docs/basic/install.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@
<a href="../theory/intro.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Introduction</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../theory/matrix_functions.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Matrix functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
Expand Down Expand Up @@ -349,12 +355,58 @@ <h1 class="title">Installation</h1>
<!-- https://stackoverflow.com/questions/122906s39/quantifiable-metrics-benchmarks-on-the-usage-of-header-only-c-libraries/13593041#13593041 -->
<section id="platform-support" class="level3">
<h3 class="anchored" data-anchor-id="platform-support">Platform support</h3>
<p>Platform-specific wheels are currently built with cibuildwheel and uploaded to PyPI. These enable <code>primate</code> to be installed on supported architecture / CPython implementations without compilation. The currently supported platforms include:</p>
<p>If your platform isn’t on this list, feel free to make an issue requesting support for your platform.</p>
<p>Platform-specific wheels are currently built with cibuildwheel and uploaded to PyPI. These enable <code>primate</code> to be installed on supported architecture / CPython implementations without compilation. As of 12/29/23, native <code>primate</code> wheels are buitl for the following platforms:</p>
<table class="table">
<thead>
<tr class="header">
<th>Platform</th>
<th style="text-align: center;">3.8</th>
<th style="text-align: center;">3.9</th>
<th style="text-align: center;">3.10</th>
<th style="text-align: center;">3.11</th>
<th style="text-align: center;">3.12</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><strong>Linux (manylinux x86_64)</strong></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
</tr>
<tr class="even">
<td><strong>MacOS (x86_64)</strong></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
</tr>
<tr class="odd">
<td><strong>MacOS ARM (arm64) <a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a></strong></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
</tr>
<tr class="even">
<td><strong>Windows (AMD64) <a href="#fn2" class="footnote-ref" id="fnref2" role="doc-noteref"><sup>2</sup></a></strong></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
<td style="text-align: center;"></td>
</tr>
</tbody>
</table>
<p>Wheels are currently built with <a href="https://cibuildwheel.readthedocs.io/en/stable/">cibuildwheel</a>. Currently no support is offered for PyPy, 32-bit runtimes, or <a href="https://devguide.python.org/versions/#supported-versions">unsupported versions of CPython</a>. If your platform isn’t on this list, feel free to make an issue requesting support.</p>
</section>
<section id="compiling-from-source" class="level3">
<h3 class="anchored" data-anchor-id="compiling-from-source">Compiling from source</h3>
<p>To install the package from its source distribution, a C++20 compiler is required; the current builds are all built with some variant of <a href="">clang</a>. For platform- and compiler-specific settings, consult the build scripts and CI configuration files.</p>
<p>To install the package from its source distribution, a C++20 compiler is required; the current builds are all built with some variant of <a href="https://clang.llvm.org/">clang</a>. For platform- and compiler-specific settings, consult the build scripts and CI configuration files.</p>
</section>
<section id="c-installation" class="level3">
<h3 class="anchored" data-anchor-id="c-installation">C++ Installation</h3>
Expand Down Expand Up @@ -389,7 +441,14 @@ <h3 class="anchored" data-anchor-id="c-installation">C++ Installation</h3>

</section>

</main> <!-- /main -->

<div id="quarto-appendix" class="default"><section id="footnotes" class="footnotes footnotes-end-of-document" role="doc-endnotes"><h2 class="anchored quarto-appendix-heading">Footnotes</h2>

<ol>
<li id="fn1"><p>Single-thread execution only; ARM-based OSX runners come stocked with Apple’s clang, which doesn’t natively ship with <code>libomp.dylib</code>, though this <a href="https://mac.r-project.org/openmp/">may be fixable</a>. Feel free to file an PR if you can get this working.<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn2"><p>Single-thread execution only; <code>primate</code> depends on OpenMP 4.5+, which isn’t supported on any Windows compiler I’m aware of.<a href="#fnref2" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section></div></main> <!-- /main -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
const toggleBodyColorMode = (bsSheetEl) => {
Expand Down
6 changes: 6 additions & 0 deletions docs/basic/integration.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@
<a href="../theory/intro.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Introduction</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../theory/matrix_functions.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Matrix functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
Expand Down
10 changes: 8 additions & 2 deletions docs/basic/performance.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@
<a href="../theory/intro.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Introduction</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../theory/matrix_functions.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Matrix functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
Expand Down Expand Up @@ -336,7 +342,7 @@ <h1 class="title">Performance</h1>
<p><code>primate</code> provides a variety of efficient algorithms for estimating quantities derived from matrix functions. These algorithms are largely implemented in C++ to minimize overhead, and for some computational problems <code>primate</code> can out-perform the standard algorithms for estimating spectral quantities by several orders of magnitude. Nonetheless, there are some performance-related caveats to be aware of.</p>
<!-- The main -->
<!-- To illustrate this, we give an example below using Toeplitz matrices. -->
<div id="370cac97" class="cell" data-execution_count="1">
<div id="a5cf844d" class="cell" data-execution_count="1">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">from</span> scipy.linalg <span class="im">import</span> toeplitz</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="im">from</span> primate.trace <span class="im">import</span> hutch </span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a></span>
Expand Down Expand Up @@ -380,7 +386,7 @@ <h1 class="title">Performance</h1>
<span id="cb1-41"><a href="#cb1-41" aria-hidden="true" tabindex="-1"></a>a, b <span class="op">=</span> lanczos(T, deg<span class="op">=</span><span class="dv">499</span>, orth<span class="op">=</span><span class="dv">150</span>)</span>
<span id="cb1-42"><a href="#cb1-42" aria-hidden="true" tabindex="-1"></a>np.<span class="bu">sum</span>(np.<span class="bu">abs</span>(eigvalsh_tridiagonal(a,b)))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div id="c8032eb8" class="cell" data-execution_count="2">
<div id="87320ce5" class="cell" data-execution_count="2">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="im">import</span> timeit </span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>timeit.timeit(<span class="kw">lambda</span>: hutch(A, maxiter<span class="op">=</span><span class="dv">20</span>, deg<span class="op">=</span><span class="dv">5</span>, fun<span class="op">=</span><span class="st">"log"</span>, quad<span class="op">=</span><span class="st">"fttr"</span>), number <span class="op">=</span> <span class="dv">1000</span>)</span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>timeit.timeit(<span class="kw">lambda</span>: np.<span class="bu">sum</span>(np.log(np.linalg.eigvalsh(A))), number <span class="op">=</span> <span class="dv">1000</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
Expand Down
10 changes: 5 additions & 5 deletions docs/basic/todo.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,14 @@
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../theory/lanczos.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">The Lanczos Method</span></a>
<a href="../theory/matrix_functions.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Matrix functions</span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../theory/matrix_functions.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">Matrix functions</span></a>
<a href="../theory/lanczos.html" class="sidebar-item-text sidebar-link">
<span class="menu-text">The Lanczos Method</span></a>
</div>
</li>
</ul>
Expand Down Expand Up @@ -323,7 +323,7 @@



<div id="7ecea2e7" class="cell" data-execution_count="1">
<div id="7e43e6e6" class="cell" data-execution_count="1">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co"># a, b = 0.8, 2</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="co"># x = np.random.uniform(low=0, high=10, size=40)</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="co"># eps = np.random.normal(loc=0, scale=1.0, size=40)</span></span>
Expand Down
Loading

0 comments on commit 2e1e334

Please sign in to comment.