Files
phy/simba/index.html
Orion Kindel 0ce894e6b0 doc
2025-03-18 10:30:23 -05:00

24 lines
5.9 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Simba is a crate defining a set of trait for writing code that can be generic with regard to the number of lanes of the numeric input value. Those traits are implemented by `f32`, `u32`, `i16`, `bool` as well as SIMD types like `f32x4, u32x8, i16x2`, etc."><title>simba - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="simba" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../simba/index.html">simba</a><span class="version">0.9.0</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#cargo-features" title="Cargo features">Cargo features</a></li></ul><h3><a href="#modules">Crate Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>simba</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/simba/lib.rs.html#1-45">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p><strong>Simba</strong> is a crate defining a set of trait for writing code that can be generic with regard to the
number of lanes of the numeric input value. Those traits are implemented by <code>f32</code>, <code>u32</code>, <code>i16</code>,
<code>bool</code> as well as SIMD types like <code>f32x4, u32x8, i16x2</code>, etc.</p>
<p>One example of use-case applied by the <a href="https://nalgebra.org">nalgebra crate</a> is to define generic methods
like vector normalization that will work for <code>Vector3&lt;f32&gt;</code> as well as <code>Vector3&lt;f32x4&gt;</code>.</p>
<p>This makes it easier leverage the power of <a href="https://www.rustsim.org/blog/2020/03/23/simd-aosoa-in-nalgebra/">SIMD Array-of-Struct-of-Array (AoSoA)</a>
with less code duplication.</p>
<h3 id="cargo-features"><a class="doc-anchor" href="#cargo-features">§</a>Cargo features</h3>
<p>Two cargo features can be optionally enabled:</p>
<ul>
<li>With the <strong><code>portable_simd</code></strong> feature enabled, the <code>simba::simd</code> module will export several SIMD types like <code>f32x2</code>,
<code>f64x4</code>, <code>i32i8</code>, <code>u16i16</code>, etc. There types are wrappers around the SIMD types from the experimental <a href="https://doc.rust-lang.org/std/simd/index.html">std::simd</a>
implementation. This requires a nightly compiler and might break after updating the compiler nightly version.</li>
<li>With the <strong><code>wide</code></strong> feature enabled, the <code>simba::simd</code> module will export the <code>WideF32x4</code> and <code>WideBoolF32x4</code>
types. The types are wrappers around the <code>wide::f32x4</code> type from the <a href="https://docs.rs/wide"><strong>wide</strong> crate</a>.
This will work with both a stable or nightly compiler.</li>
</ul>
<p>If none of those features are enabled, <strong>simba</strong> will still define all the scalar and SIMD traits.
However, the SIMD traits wont be implemented for any SIMD types. Therefore it is recommended to:</p>
<ul>
<li>Use the <code>portable_simd</code> feature if you want more features, and can afford to use a nightly compiler.</li>
<li>Use the <code>wide</code> feature if you only need 4-lanes 32-bits floats, and cant afford to use a nightly compiler.</li>
</ul>
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="scalar/index.html" title="mod simba::scalar">scalar</a></div><div class="desc docblock-short">Traits implemented by scalar, non-SIMD, types.</div></li><li><div class="item-name"><a class="mod" href="simd/index.html" title="mod simba::simd">simd</a></div><div class="desc docblock-short">Traits implemented by SIMD types and non-SIMD types.</div></li></ul></section></div></main></body></html>