<!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."><meta name="keywords" content="rust, rustlang, rust-lang, simba"><title>simba - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-1f7d512b176f0f72.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-124a1ca42af929b6.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-6827029ac823cab7.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../static.files/light-ebce58d0a40c3431.css"><link rel="stylesheet" disabled href="../static.files/dark-f23faae4a2daf9a6.css"><link rel="stylesheet" disabled href="../static.files/ayu-8af5e100b21cd173.css"><script id="default-settings" ></script><script src="../static.files/storage-d43fa987303ecbbb.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-c55e1eb52e1886b4.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.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">☰</button><a class="sidebar-logo" href="../simba/index.html"><div class="logo-container"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../simba/index.html"><div class="logo-container"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></div></a><h2 class="location"><a href="#">Crate simba</a></h2><div class="sidebar-elems"><ul class="block"><li class="version">Version 0.8.0</li><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#modules">Modules</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-5ec35bf9ca753509.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Crate <a class="mod" href="#">simba</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/simba/lib.rs.html#1-42">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="rustdoc-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<f32></code> as well as <code>Vector3<f32x4></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 href="#cargo-features">Cargo features</a></h3>
<p>Two cargo features can be optionally enabled:</p>
<ul>
<li>With the <strong><code>packed_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 <a href="https://docs.rs/packed_simd"><strong>packed_simd</strong>
crate</a>. This requires a nightly compiler.</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 won’t be implemented for any SIMD types. Therefore it is recommended to:</p>
<ul>
<li>Use the <code>packed_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 can’t afford to use a nightly compiler.</li>
</ul>
</div></details><h2 id="modules" class="small-section-header"><a href="#modules">Modules</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="scalar/index.html" title="simba::scalar mod">scalar</a></div><div class="item-right docblock-short">Traits implemented by scalar, non-SIMD, types.</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="simd/index.html" title="simba::simd mod">simd</a></div><div class="item-right docblock-short">Traits implemented by SIMD types and non-SIMD types.</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="simba" data-themes="" data-resource-suffix="" data-rustdoc-version="1.67.1 (d5a82bbd2 2023-02-07)" data-search-js="search-444266647c4dba98.js" data-settings-js="settings-bebeae96e00e4617.js" data-settings-css="settings-af96d9e2fc13e081.css" ></div></body></html>