Skip to content

Commit 01e50a5

Browse files
committed
docs update
1 parent 8a31e77 commit 01e50a5

8 files changed

Lines changed: 24 additions & 9 deletions

File tree

.doctrees/environment.pickle

26 Bytes
Binary file not shown.

.doctrees/setup.doctree

775 Bytes
Binary file not shown.

.doctrees/symbols.doctree

2.94 KB
Binary file not shown.

_sources/setup.md.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ build/examples/examples # Examples
4444
| `SYMX_ENABLE_AVX2` | `AUTO` | Enable AVX2 + FMA SIMD paths (`AUTO` / `ON` / `OFF`); `AUTO` enables on x86/x86_64/AMD64 |
4545
| `SYMX_COMPILER_PATH` | `AUTO` | Compiler used for JIT code generation at runtime |
4646
| `SYMX_CODEGEN_DIR` | *(empty)* | Output directory for generated files; defaults to `<build>/codegen` |
47-
| `SYMX_HESS_STORAGE_FLOAT` | `float` | Hessian storage precision (`float` or `double`) |
47+
| `SYMX_HESS_STORAGE_FLOAT` | `double` | Hessian storage precision (`float` or `double`) |
4848

4949

5050
### AVX2 support
@@ -59,9 +59,11 @@ If you try to compile on a non-AVX2 system with `ON`, you will get something lik
5959
../immintrin.h:14 error "This header is only meant to be used on x86 and x64 architecture"
6060
```
6161

62-
### `float` Hessian approximation
62+
### `float` Hessian approximation (performance)
6363
Using `SYMX_HESS_STORAGE_FLOAT=float` lets SymX store the global Hessian used in Newton's Method in single point precision.
64-
Importantly, all _operations_ are still performed in `double` (via casting). This option simply quantizes the global matrix values to `float`, halving memory traffic and significantly increasing performance.
64+
Importantly, all _operations_ are still performed in `double` (via casting).
65+
This option simply quantizes the global matrix values to `float`, halving memory traffic and significantly increasing performance.
66+
The default remains `double` as very numerically stiff problems might require it, but the user is encouraged to assess whether `float` works for their application.
6567

6668

6769
## Compiler path

_sources/symbols.md.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ These can be differentiated and their generated code will feature actual `if-els
5959
Operations such as `min(), max()` use `branch` internally.
6060
Note that the use of `branch` prevents emitting SIMD code.
6161

62+
**Important:** The condition passed to `branch` is a `Scalar` whose **sign** determines which branch executes.
63+
When you write `a > b`, SymX internally stores `a - b` as the condition scalar.
64+
Opposite for `a < b`.
65+
The true branch executes when that condition scalar is **strictly positive** (`> 0`), exact zero will then fall to the false branch.
66+
Due to the floating point nature of the comparison, the user might consider writing activation mechanisms with conditions that are `+1` and `-1` (instead of `0`) to more clearly indicate sign.
67+
6268
## `Vector` and `Matrix`
6369
`Vector` and `Matrix` are simply a list of `Scalar`s that provide typical algebraic operator overloads.
6470
Further, `Vector` provides `norm(), dot(), cross3()` and such, while `Matrix` provides `det(), inv(), trace()` etc.

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ <h2>CMake options<a class="headerlink" href="#cmake-options" title="Link to this
335335
<td><p>Output directory for generated files; defaults to <code class="docutils literal notranslate"><span class="pre">&lt;build&gt;/codegen</span></code></p></td>
336336
</tr>
337337
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">SYMX_HESS_STORAGE_FLOAT</span></code></p></td>
338-
<td><p><code class="docutils literal notranslate"><span class="pre">float</span></code></p></td>
338+
<td><p><code class="docutils literal notranslate"><span class="pre">double</span></code></p></td>
339339
<td><p>Hessian storage precision (<code class="docutils literal notranslate"><span class="pre">float</span></code> or <code class="docutils literal notranslate"><span class="pre">double</span></code>)</p></td>
340340
</tr>
341341
</tbody>
@@ -352,10 +352,12 @@ <h3>AVX2 support<a class="headerlink" href="#avx2-support" title="Link to this h
352352
</pre></div>
353353
</div>
354354
</section>
355-
<section id="float-hessian-approximation">
356-
<h3><code class="docutils literal notranslate"><span class="pre">float</span></code> Hessian approximation<a class="headerlink" href="#float-hessian-approximation" title="Link to this heading"></a></h3>
355+
<section id="float-hessian-approximation-performance">
356+
<h3><code class="docutils literal notranslate"><span class="pre">float</span></code> Hessian approximation (performance)<a class="headerlink" href="#float-hessian-approximation-performance" title="Link to this heading"></a></h3>
357357
<p>Using <code class="docutils literal notranslate"><span class="pre">SYMX_HESS_STORAGE_FLOAT=float</span></code> lets SymX store the global Hessian used in Newton’s Method in single point precision.
358-
Importantly, all <em>operations</em> are still performed in <code class="docutils literal notranslate"><span class="pre">double</span></code> (via casting). This option simply quantizes the global matrix values to <code class="docutils literal notranslate"><span class="pre">float</span></code>, halving memory traffic and significantly increasing performance.</p>
358+
Importantly, all <em>operations</em> are still performed in <code class="docutils literal notranslate"><span class="pre">double</span></code> (via casting).
359+
This option simply quantizes the global matrix values to <code class="docutils literal notranslate"><span class="pre">float</span></code>, halving memory traffic and significantly increasing performance.
360+
The default remains <code class="docutils literal notranslate"><span class="pre">double</span></code> as very numerically stiff problems might require it, but the user is encouraged to assess whether <code class="docutils literal notranslate"><span class="pre">float</span></code> works for their application.</p>
359361
</section>
360362
</section>
361363
<section id="compiler-path">
@@ -513,7 +515,7 @@ <h3>Diagnose compilers<a class="headerlink" href="#diagnose-compilers" title="Li
513515
<li><a class="reference internal" href="#building">Building</a></li>
514516
<li><a class="reference internal" href="#cmake-options">CMake options</a><ul>
515517
<li><a class="reference internal" href="#avx2-support">AVX2 support</a></li>
516-
<li><a class="reference internal" href="#float-hessian-approximation"><code class="docutils literal notranslate"><span class="pre">float</span></code> Hessian approximation</a></li>
518+
<li><a class="reference internal" href="#float-hessian-approximation-performance"><code class="docutils literal notranslate"><span class="pre">float</span></code> Hessian approximation (performance)</a></li>
517519
</ul>
518520
</li>
519521
<li><a class="reference internal" href="#compiler-path">Compiler path</a><ul>

symbols.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,11 @@ <h3>Branching<a class="headerlink" href="#branching" title="Link to this heading
315315
<p>These can be differentiated and their generated code will feature actual <code class="docutils literal notranslate"><span class="pre">if-else</span></code> statements.
316316
Operations such as <code class="docutils literal notranslate"><span class="pre">min(),</span> <span class="pre">max()</span></code> use <code class="docutils literal notranslate"><span class="pre">branch</span></code> internally.
317317
Note that the use of <code class="docutils literal notranslate"><span class="pre">branch</span></code> prevents emitting SIMD code.</p>
318+
<p><strong>Important:</strong> The condition passed to <code class="docutils literal notranslate"><span class="pre">branch</span></code> is a <code class="docutils literal notranslate"><span class="pre">Scalar</span></code> whose <strong>sign</strong> determines which branch executes.
319+
When you write <code class="docutils literal notranslate"><span class="pre">a</span> <span class="pre">&gt;</span> <span class="pre">b</span></code>, SymX internally stores <code class="docutils literal notranslate"><span class="pre">a</span> <span class="pre">-</span> <span class="pre">b</span></code> as the condition scalar.
320+
Opposite for <code class="docutils literal notranslate"><span class="pre">a</span> <span class="pre">&lt;</span> <span class="pre">b</span></code>.
321+
The true branch executes when that condition scalar is <strong>strictly positive</strong> (<code class="docutils literal notranslate"><span class="pre">&gt;</span> <span class="pre">0</span></code>), exact zero will then fall to the false branch.
322+
Due to the floating point nature of the comparison, the user might consider writing activation mechanisms with conditions that are <code class="docutils literal notranslate"><span class="pre">+1</span></code> and <code class="docutils literal notranslate"><span class="pre">-1</span></code> (instead of <code class="docutils literal notranslate"><span class="pre">0</span></code>) to more clearly indicate sign.</p>
318323
</section>
319324
</section>
320325
<section id="vector-and-matrix">

0 commit comments

Comments
 (0)