Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 20, 2023
1 parent 680f5f9 commit d28c315
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 37 deletions.
Binary file modified nightly/.doctrees/environment.pickle
Binary file not shown.
Binary file modified nightly/.doctrees/optimisation.doctree
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -218,38 +218,48 @@ <h1>Source code for cil.optimisation.operators.SymmetrisedGradientOperator</h1><

<div class="viewcode-block" id="SymmetrisedGradientOperator"><a class="viewcode-back" href="../../../../optimisation.html#cil.optimisation.operators.SymmetrisedGradientOperator">[docs]</a><span class="k">class</span> <span class="nc">SymmetrisedGradientOperator</span><span class="p">(</span><span class="n">LinearOperator</span><span class="p">):</span>
<span class="w"> </span>
<span class="w"> </span><span class="sa">r</span><span class="sd">&#39;&#39;&#39;Symmetrized Gradient Operator: E: V -&gt; W</span>
<span class="w"> </span><span class="sa">r</span><span class="sd">&#39;&#39;&#39; The symmetrised gradient is the operator, :math:`E`, defined by :math:`E: V \rightarrow W` where `V` is `BlockGeometry` and `W` is the range of the Symmetrised Gradient and </span>
<span class="sd"> </span>
<span class="sd"> V : range of the Gradient Operator</span>
<span class="sd"> W : range of the Symmetrized Gradient </span>

<span class="sd"> Example (2D): </span>
<span class="sd"> .. math::</span>
<span class="sd"> </span>
<span class="sd"> E(v) = 0.5 ( \nabla v + (\nabla v)^{T} ) \\</span>
<span class="sd"> </span>
<span class="sd"> </span>
<span class="sd"> In 2 dimensions, let :math:`v(x,y)=(v_1(x,y),v_2(x,y))` which gives</span>
<span class="sd"> </span>
<span class="sd"> .. math::</span>
<span class="sd"> v = (v1, v2) \\</span>
<span class="sd"> </span>
<span class="sd"> Ev = 0.5 * ( \nabla\cdot v + (\nabla\cdot c)^{T} ) \\</span>
<span class="sd"> </span>
<span class="sd"> \begin{matrix} </span>
<span class="sd"> \partial_{y} v1 &amp; 0.5 * (\partial_{x} v1 + \partial_{y} v2) \\</span>
<span class="sd"> 0.5 * (\partial_{x} v1 + \partial_{y} v2) &amp; \partial_{x} v2 </span>
<span class="sd"> \end{matrix}</span>
<span class="sd"> </span>
<span class="sd"> \nabla v =\left( \begin{matrix} </span>
<span class="sd"> \partial_{x} v_1 &amp; \partial_x v_2\\</span>
<span class="sd"> \partial_{y}v_1 &amp; \partial_y v_2</span>
<span class="sd"> \end{matrix}\right)</span>
<span class="sd"> </span>
<span class="sd"> and thus </span>
<span class="sd"> </span>
<span class="sd"> .. math::</span>
<span class="sd"> </span>
<span class="sd"> E(v) = 0.5 ( \nabla v + (\nabla v)^{T} ) </span>
<span class="sd"> =\left( \begin{matrix} </span>
<span class="sd"> \partial_{x} v_1 &amp; 0.5 (\partial_{y} v_1 + \partial_{x} v_2) \\</span>
<span class="sd"> 0.5 (\partial_{x} v_1 + \partial_{y} v_2) &amp; \partial_{y} v_2 </span>
<span class="sd"> \end{matrix}\right)</span>
<span class="sd"> </span>
<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> domain_geometry: `BlockGeometry` with shape (2,1) or (3,1)</span>
<span class="sd"> Set up the domain of the function. </span>
<span class="sd"> bnd_cond: str, optional, default :code:`Neumann`</span>
<span class="sd"> Boundary condition either :code:`Neumann` or :code:`Periodic`</span>
<span class="sd"> correlation: str, optional, default :code:`Channel`</span>
<span class="sd"> Correlation either :code:`SpaceChannel` or :code:`Channel`</span>
<span class="sd"> </span>
<span class="sd"> &#39;&#39;&#39;</span>

<span class="n">CORRELATION_SPACE</span> <span class="o">=</span> <span class="s2">&quot;Space&quot;</span>
<span class="n">CORRELATION_SPACECHANNEL</span> <span class="o">=</span> <span class="s2">&quot;SpaceChannels&quot;</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">domain_geometry</span><span class="p">,</span> <span class="n">bnd_cond</span> <span class="o">=</span> <span class="s1">&#39;Neumann&#39;</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;creator</span>
<span class="sd"> </span>
<span class="sd"> :param domain_geometry: domain of the operator</span>
<span class="sd"> :param bnd_cond: boundary condition, either :code:`Neumann` or :code:`Periodic`.</span>
<span class="sd"> :type bnd_cond: str, optional, default :code:`Neumann`</span>
<span class="sd"> :param correlation: :code:`SpaceChannel` or :code:`Channel`</span>
<span class="sd"> :type correlation: str, optional, default :code:`Channel`</span>
<span class="sd"> &#39;&#39;&#39;</span>


<span class="bp">self</span><span class="o">.</span><span class="n">bnd_cond</span> <span class="o">=</span> <span class="n">bnd_cond</span>
<span class="bp">self</span><span class="o">.</span><span class="n">correlation</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;correlation&#39;</span><span class="p">,</span><span class="n">SymmetrisedGradientOperator</span><span class="o">.</span><span class="n">CORRELATION_SPACE</span><span class="p">)</span>

Expand All @@ -272,7 +282,15 @@ <h1>Source code for cil.optimisation.operators.SymmetrisedGradientOperator</h1><

<div class="viewcode-block" id="SymmetrisedGradientOperator.direct"><a class="viewcode-back" href="../../../../optimisation.html#cil.optimisation.operators.SymmetrisedGradientOperator.direct">[docs]</a> <span class="k">def</span> <span class="nf">direct</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">out</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="w"> </span>
<span class="w"> </span><span class="sd">&#39;&#39;&#39;Returns E(v)&#39;&#39;&#39;</span>
<span class="w"> </span><span class="sa">r</span><span class="sd">&#39;&#39;&#39;Returns :math:`E(v) = 0.5 * ( \nabla v + (\nabla v)^{T} )` </span>
<span class="sd"> </span>
<span class="sd"> Parameters:</span>
<span class="sd"> -------------</span>
<span class="sd"> </span>
<span class="sd"> x: BlockDataContainer</span>
<span class="sd"> out: BlockDataContainer, default None</span>
<span class="sd"> If out is not None the output of direct will be filled in out, otherwise a new object is instantiated and returned.</span>
<span class="sd"> &#39;&#39;&#39;</span>

<span class="k">if</span> <span class="n">out</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>

Expand Down Expand Up @@ -301,7 +319,16 @@ <h1>Source code for cil.optimisation.operators.SymmetrisedGradientOperator</h1><


<div class="viewcode-block" id="SymmetrisedGradientOperator.adjoint"><a class="viewcode-back" href="../../../../optimisation.html#cil.optimisation.operators.SymmetrisedGradientOperator.adjoint">[docs]</a> <span class="k">def</span> <span class="nf">adjoint</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">out</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>

<span class="w"> </span><span class="sa">r</span><span class="sd">&#39;&#39;&#39;Returns the adjoint of the symmetrised gradient operator</span>
<span class="sd"> </span>
<span class="sd"> Parameters:</span>
<span class="sd"> -------------</span>
<span class="sd"> </span>
<span class="sd"> x: BlockDataContainer</span>
<span class="sd"> out: BlockDataContainer, default None</span>
<span class="sd"> If out is not None the output of adjoint will be filled in out, otherwise a new object is instantiated and returned.</span>
<span class="sd"> &#39;&#39;&#39;</span>

<span class="k">if</span> <span class="n">out</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>

<span class="n">tmp</span> <span class="o">=</span> <span class="p">[</span><span class="kc">None</span><span class="p">]</span><span class="o">*</span><span class="bp">self</span><span class="o">.</span><span class="n">domain_geometry</span><span class="p">()</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
Expand Down
55 changes: 43 additions & 12 deletions nightly/optimisation.html
Original file line number Diff line number Diff line change
Expand Up @@ -3159,26 +3159,57 @@ <h3>GradientOperator<a class="headerlink" href="#gradientoperator" title="Permal
<dl class="py class">
<dt id="cil.optimisation.operators.SymmetrisedGradientOperator">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">cil.optimisation.operators.</span></code><code class="sig-name descname"><span class="pre">SymmetrisedGradientOperator</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">domain_geometry</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bnd_cond</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'Neumann'</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cil/optimisation/operators/SymmetrisedGradientOperator.html#SymmetrisedGradientOperator"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cil.optimisation.operators.SymmetrisedGradientOperator" title="Permalink to this definition">#</a></dt>
<dd><p>Symmetrized Gradient Operator: E: V -&gt; W</p>
<p>V : range of the Gradient Operator
W : range of the Symmetrized Gradient</p>
<p>Example (2D):</p>
<div class="math notranslate nohighlight">
\[ \begin{align}\begin{aligned}\begin{split}v = (v1, v2) \\\end{split}\\\begin{split}Ev = 0.5 * ( \nabla\cdot v + (\nabla\cdot c)^{T} ) \\\end{split}\\\begin{split}\begin{matrix}
\partial_{y} v1 &amp; 0.5 * (\partial_{x} v1 + \partial_{y} v2) \\
0.5 * (\partial_{x} v1 + \partial_{y} v2) &amp; \partial_{x} v2
\end{matrix}\end{split}\end{aligned}\end{align} \]</div>
<dd><p>The symmetrised gradient is the operator, <span class="math notranslate nohighlight">\(E\)</span>, defined by <span class="math notranslate nohighlight">\(E: V \rightarrow W\)</span> where <cite>V</cite> is <cite>BlockGeometry</cite> and <cite>W</cite> is the range of the Symmetrised Gradient and</p>
<blockquote>
<div><div class="math notranslate nohighlight">
\[\begin{split}E(v) = 0.5 ( \nabla v + (\nabla v)^{T} ) \\\end{split}\]</div>
</div></blockquote>
<p>In 2 dimensions, let <span class="math notranslate nohighlight">\(v(x,y)=(v_1(x,y),v_2(x,y))\)</span> which gives</p>
<blockquote>
<div><div class="math notranslate nohighlight">
\[\begin{split}\nabla v =\left( \begin{matrix}
\partial_{x} v_1 &amp; \partial_x v_2\\
\partial_{y}v_1 &amp; \partial_y v_2
\end{matrix}\right)\end{split}\]</div>
</div></blockquote>
<p>and thus</p>
<blockquote>
<div><div class="math notranslate nohighlight">
\[\begin{split}E(v) = 0.5 ( \nabla v + (\nabla v)^{T} )
=\left( \begin{matrix}
\partial_{x} v_1 &amp; 0.5 (\partial_{y} v_1 + \partial_{x} v_2) \\
0.5 (\partial_{x} v_1 + \partial_{y} v_2) &amp; \partial_{y} v_2
\end{matrix}\right)\end{split}\]</div>
</div></blockquote>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>domain_geometry</strong> (<cite>BlockGeometry</cite> with shape (2,1) or (3,1)) – Set up the domain of the function.</p></li>
<li><p><strong>bnd_cond</strong> (str, optional, default <code class="code docutils literal notranslate"><span class="pre">Neumann</span></code>) – Boundary condition either <code class="code docutils literal notranslate"><span class="pre">Neumann</span></code> or <code class="code docutils literal notranslate"><span class="pre">Periodic</span></code></p></li>
<li><p><strong>correlation</strong> (str, optional, default <code class="code docutils literal notranslate"><span class="pre">Channel</span></code>) – Correlation either <code class="code docutils literal notranslate"><span class="pre">SpaceChannel</span></code> or <code class="code docutils literal notranslate"><span class="pre">Channel</span></code></p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt id="cil.optimisation.operators.SymmetrisedGradientOperator.direct">
<code class="sig-name descname"><span class="pre">direct</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">out</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cil/optimisation/operators/SymmetrisedGradientOperator.html#SymmetrisedGradientOperator.direct"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cil.optimisation.operators.SymmetrisedGradientOperator.direct" title="Permalink to this definition">#</a></dt>
<dd><p>Returns E(v)</p>
<dd><p>Returns <span class="math notranslate nohighlight">\(E(v) = 0.5 * ( \nabla v + (\nabla v)^{T} )\)</span></p>
<p>x: BlockDataContainer
out: BlockDataContainer, default None</p>
<blockquote>
<div><p>If out is not None the output of direct will be filled in out, otherwise a new object is instantiated and returned.</p>
</div></blockquote>
</dd></dl>

<dl class="py method">
<dt id="cil.optimisation.operators.SymmetrisedGradientOperator.adjoint">
<code class="sig-name descname"><span class="pre">adjoint</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">x</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">out</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cil/optimisation/operators/SymmetrisedGradientOperator.html#SymmetrisedGradientOperator.adjoint"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#cil.optimisation.operators.SymmetrisedGradientOperator.adjoint" title="Permalink to this definition">#</a></dt>
<dd><p>returns the adjoint/inverse operation</p>
<p>only available to linear operators</p>
<dd><p>Returns the adjoint of the symmetrised gradient operator</p>
<p>x: BlockDataContainer
out: BlockDataContainer, default None</p>
<blockquote>
<div><p>If out is not None the output of adjoint will be filled in out, otherwise a new object is instantiated and returned.</p>
</div></blockquote>
</dd></dl>

</dd></dl>
Expand Down
2 changes: 1 addition & 1 deletion nightly/searchindex.js

Large diffs are not rendered by default.

0 comments on commit d28c315

Please sign in to comment.