Skip to content

Commit

Permalink
build based on cb2ae25
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Apr 19, 2024
1 parent 19bd5fe commit a1ec5f4
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 76 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-19T15:07:54","documenter_version":"1.3.0"}}
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-19T16:16:38","documenter_version":"1.4.0"}}
82 changes: 82 additions & 0 deletions dev/api/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>API Reference · SparseConnectivityTracer.jl</title><meta name="title" content="API Reference · SparseConnectivityTracer.jl"/><meta property="og:title" content="API Reference · SparseConnectivityTracer.jl"/><meta property="twitter:title" content="API Reference · SparseConnectivityTracer.jl"/><meta name="description" content="Documentation for SparseConnectivityTracer.jl."/><meta property="og:description" content="Documentation for SparseConnectivityTracer.jl."/><meta property="twitter:description" content="Documentation for SparseConnectivityTracer.jl."/><meta property="og:url" content="https://adrhill.github.io/SparseConnectivityTracer.jl/api/"/><meta property="twitter:url" content="https://adrhill.github.io/SparseConnectivityTracer.jl/api/"/><link rel="canonical" href="https://adrhill.github.io/SparseConnectivityTracer.jl/api/"/><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../search_index.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="../">SparseConnectivityTracer.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../">Home</a></li><li class="is-active"><a class="tocitem" href>API Reference</a><ul class="internal"><li><a class="tocitem" href="#Interface"><span>Interface</span></a></li><li><a class="tocitem" href="#Internals"><span>Internals</span></a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>API Reference</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>API Reference</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/adrhill/SparseConnectivityTracer.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/adrhill/SparseConnectivityTracer.jl/blob/main/docs/src/api.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="API-Reference"><a class="docs-heading-anchor" href="#API-Reference">API Reference</a><a id="API-Reference-1"></a><a class="docs-heading-anchor-permalink" href="#API-Reference" title="Permalink"></a></h1><ul><li><a href="#SparseConnectivityTracer.Tracer"><code>SparseConnectivityTracer.Tracer</code></a></li><li><a href="#SparseConnectivityTracer.connectivity"><code>SparseConnectivityTracer.connectivity</code></a></li><li><a href="#SparseConnectivityTracer.inputs"><code>SparseConnectivityTracer.inputs</code></a></li><li><a href="#SparseConnectivityTracer.trace_input"><code>SparseConnectivityTracer.trace_input</code></a></li><li><a href="#SparseConnectivityTracer.tracer"><code>SparseConnectivityTracer.tracer</code></a></li></ul><h2 id="Interface"><a class="docs-heading-anchor" href="#Interface">Interface</a><a id="Interface-1"></a><a class="docs-heading-anchor-permalink" href="#Interface" title="Permalink"></a></h2><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="SparseConnectivityTracer.connectivity" href="#SparseConnectivityTracer.connectivity"><code>SparseConnectivityTracer.connectivity</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">connectivity(f, x)</code></pre><p>Enumerates inputs <code>x</code> and primal outputs <code>y=f(x)</code> and returns sparse connectivity matrix <code>C</code> of size <code>(m, n)</code> where <code>C[i, j]</code> is true if the compute graph connects the <code>i</code>-th entry in <code>y</code> to the <code>j</code>-th entry in <code>x</code>.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl hljs">julia&gt; x = rand(3);

julia&gt; f(x) = [x[1]^2, 2 * x[1] * x[2]^2, sin(x[3])];

julia&gt; connectivity(f, x)
3×3 SparseArrays.SparseMatrixCSC{Bool, UInt64} with 4 stored entries:
1 ⋅ ⋅
1 1 ⋅
⋅ ⋅ 1</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/adrhill/SparseConnectivityTracer.jl/blob/cb2ae257ae74db12fe7304cb3aaf7553ee5ddc5e/src/connectivity.jl#L35-L53">source</a></section><section><div><pre><code class="language-julia hljs">connectivity(f!, y, x)</code></pre><p>Enumerates inputs <code>x</code> and primal outputs <code>y</code> after <code>f!(y, x)</code> and returns sparse connectivity matrix <code>C</code> of size <code>(m, n)</code> where <code>C[i, j]</code> is true if the compute graph connects the <code>i</code>-th entry in <code>y</code> to the <code>j</code>-th entry in <code>x</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/adrhill/SparseConnectivityTracer.jl/blob/cb2ae257ae74db12fe7304cb3aaf7553ee5ddc5e/src/connectivity.jl#L60-L65">source</a></section></article><h2 id="Internals"><a class="docs-heading-anchor" href="#Internals">Internals</a><a id="Internals-1"></a><a class="docs-heading-anchor-permalink" href="#Internals" title="Permalink"></a></h2><p>SparseConnectivityTracer works by pushing a <code>Number</code> type called <a href="#SparseConnectivityTracer.Tracer"><code>Tracer</code></a> through generic functions:</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="SparseConnectivityTracer.Tracer" href="#SparseConnectivityTracer.Tracer"><code>SparseConnectivityTracer.Tracer</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">Tracer(indexset) &lt;: Number</code></pre><p>Number type keeping track of input indices of previous computations.</p><p>See also the convenience constructor <a href="#SparseConnectivityTracer.tracer"><code>tracer</code></a>. For a higher-level interface, refer to <a href="#SparseConnectivityTracer.connectivity"><code>connectivity</code></a>.</p><p><strong>Examples</strong></p><p>By enumerating inputs with tracers, we can keep track of input connectivities:</p><pre><code class="language-julia-repl hljs">julia&gt; xt = [tracer(1), tracer(2), tracer(3)]
3-element Vector{Tracer}:
Tracer(1,)
Tracer(2,)
Tracer(3,)

julia&gt; f(x) = [x[1]^2, 2 * x[1] * x[2]^2, sin(x[3])];

julia&gt; yt = f(xt)
3-element Vector{Tracer}:
Tracer(1,)
Tracer(1, 2)
Tracer(3,)</code></pre><p>This works by overloading operators to either keep input connectivities constant, compute unions or set connectivities to zero:</p><pre><code class="language-julia-repl hljs">julia&gt; x = tracer(1, 2, 3)
Tracer(1, 2, 3)

julia&gt; sin(x) # Most operators don&#39;t modify input connectivities.
Tracer(1, 2, 3)

julia&gt; 2 * x^3
Tracer(1, 2, 3)

julia&gt; zero(x) # Tracer is strictly operator overloading...
Tracer()

julia&gt; 0 * x # ...and doesn&#39;t look at input values.
Tracer(1, 2, 3)

julia&gt; y = tracer(3, 5)
Tracer(3, 5)

julia&gt; x + y # Operations on two Tracers construct union sets
Tracer(1, 2, 3, 5)

julia&gt; x ^ y
Tracer(1, 2, 3, 5)</code></pre><p><a href="#SparseConnectivityTracer.Tracer"><code>Tracer</code></a> also supports random number generation and pre-allocations:</p><pre><code class="language-julia-repl hljs">julia&gt; M = rand(Tracer, 3, 2)
3×2 Matrix{Tracer}:
Tracer() Tracer()
Tracer() Tracer()
Tracer() Tracer()

julia&gt; similar(M)
3×2 Matrix{Tracer}:
Tracer() Tracer()
Tracer() Tracer()
Tracer() Tracer()

julia&gt; M * [x, y]
3-element Vector{Tracer}:
Tracer(1, 2, 3, 5)
Tracer(1, 2, 3, 5)
Tracer(1, 2, 3, 5)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/adrhill/SparseConnectivityTracer.jl/blob/cb2ae257ae74db12fe7304cb3aaf7553ee5ddc5e/src/tracer.jl#L1-L75">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="SparseConnectivityTracer.tracer" href="#SparseConnectivityTracer.tracer"><code>SparseConnectivityTracer.tracer</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">tracer(index)
tracer(indices)</code></pre><p>Convenience constructor for <a href="#SparseConnectivityTracer.Tracer"><code>Tracer</code></a> from input indices.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/adrhill/SparseConnectivityTracer.jl/blob/cb2ae257ae74db12fe7304cb3aaf7553ee5ddc5e/src/tracer.jl#L91-L96">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="SparseConnectivityTracer.trace_input" href="#SparseConnectivityTracer.trace_input"><code>SparseConnectivityTracer.trace_input</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">trace_input(x)</code></pre><p>Enumerates input indices and constructs <a href="#SparseConnectivityTracer.Tracer"><code>Tracer</code></a>s.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl hljs">julia&gt; x = rand(3);

julia&gt; f(x) = [x[1]^2, 2 * x[1] * x[2]^2, sin(x[3])];

julia&gt; xt = trace_input(x)
3-element Vector{Tracer}:
Tracer(1,)
Tracer(2,)
Tracer(3,)

julia&gt; yt = f(xt)
3-element Vector{Tracer}:
Tracer(1,)
Tracer(1, 2)
Tracer(3,)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/adrhill/SparseConnectivityTracer.jl/blob/cb2ae257ae74db12fe7304cb3aaf7553ee5ddc5e/src/connectivity.jl#L3-L26">source</a></section></article><p>The following utilities can be used to extract input indices from <a href="#SparseConnectivityTracer.Tracer"><code>Tracer</code></a>s:</p><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="SparseConnectivityTracer.inputs" href="#SparseConnectivityTracer.inputs"><code>SparseConnectivityTracer.inputs</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">inputs(tracer)</code></pre><p>Return raw <code>UInt64</code> input indices of a <a href="#SparseConnectivityTracer.Tracer"><code>Tracer</code></a>.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl hljs">julia&gt; t = tracer(1, 2, 4)
Tracer(1, 2, 4)

julia&gt; inputs(t)
3-element Vector{Int64}:
1
2
4</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/adrhill/SparseConnectivityTracer.jl/blob/cb2ae257ae74db12fe7304cb3aaf7553ee5ddc5e/src/tracer.jl#L102-L118">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« Home</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.4.0 on <span class="colophon-date" title="Friday 19 April 2024 16:16">Friday 19 April 2024</span>. Using Julia version 1.10.2.</p></section><footer class="modal-card-foot"></footer></div></div></div></body><div data-docstringscollapsed="true"></div></html>
Loading

0 comments on commit a1ec5f4

Please sign in to comment.