blob: 8e6ccae29cbecdf00b7e9d5bf19796bc1150154f [file] [log] [blame]
<!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="The norm module"><meta name="keywords" content="rust, rustlang, rust-lang, norm"><title>rusty_machine::linalg::norm - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../../../normalize.css"><link rel="stylesheet" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../../../ayu.css" disabled><link rel="stylesheet" href="../../../dark.css" disabled><link rel="stylesheet" href="../../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../../storage.js"></script><script defer src="../../../main.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg"></head><body class="rustdoc mod"><!--[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">&#9776;</button><a class="sidebar-logo" href="../../../rusty_machine/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../rusty_machine/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Module norm</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" 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="../../../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Module <a href="../../index.html">rusty_machine</a>::<wbr><a href="../index.html">linalg</a>::<wbr><a class="mod" href="#">norm</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/rulinalg/lib.rs.html#101">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The norm module</p>
<p>This module contains implementations of various linear algebra norms.
The implementations are contained within the <code>VectorNorm</code> and
<code>MatrixNorm</code> traits. This module also contains <code>VectorMetric</code> and
<code>MatrixMetric</code> traits which are used to compute the metric distance.</p>
<p>These traits can be used directly by importing implementors from
this module. In most cases it will be easier to use the <code>norm</code> and
<code>metric</code> functions which exist for both vectors and matrices. These
functions take generic arguments for the norm to be used.</p>
<p>In general you should use the least generic norm that fits your purpose.
For example you would choose to use a <code>Euclidean</code> norm instead of an
<code>Lp(2.0)</code> norm - despite them being mathematically equivalent. </p>
<h2 id="defining-your-own-norm"><a href="#defining-your-own-norm">Defining your own norm</a></h2>
<p>Note that these traits enforce no requirements on the norm. It is up
to the user to ensure that they define a norm correctly.</p>
<p>To define your own norm you need to implement the <code>MatrixNorm</code>
and/or the <code>VectorNorm</code> on your own struct. When you have defined
a norm you get the <em>induced metric</em> for free. This means that any
object which implements the <code>VectorNorm</code> or <code>MatrixNorm</code> will
automatically implement the <code>VectorMetric</code> and <code>MatrixMetric</code> traits
respectively. This induced metric will compute the norm of the
difference between the vectors or matrices.</p>
</div></details><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Euclidean.html" title="rusty_machine::linalg::norm::Euclidean struct">Euclidean</a></div><div class="item-right docblock-short">The Euclidean norm</div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Lp.html" title="rusty_machine::linalg::norm::Lp enum">Lp</a></div><div class="item-right docblock-short">The Lp norm</div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.MatrixMetric.html" title="rusty_machine::linalg::norm::MatrixMetric trait">MatrixMetric</a></div><div class="item-right docblock-short">Trait for matrix metrics.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.MatrixNorm.html" title="rusty_machine::linalg::norm::MatrixNorm trait">MatrixNorm</a></div><div class="item-right docblock-short">Trait for matrix norms.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.VectorMetric.html" title="rusty_machine::linalg::norm::VectorMetric trait">VectorMetric</a></div><div class="item-right docblock-short">Trait for vector metrics.</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.VectorNorm.html" title="rusty_machine::linalg::norm::VectorNorm trait">VectorNorm</a></div><div class="item-right docblock-short">Trait for vector norms</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="rusty_machine" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>