blob: 6c87e14cb57ed47ef5888d35ec14e8007271eaf6 [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="Decompositions for matrices."><meta name="keywords" content="rust, rustlang, rust-lang, decomposition"><title>rulinalg::matrix::decomposition - 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="../../../rulinalg/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="../../../rulinalg/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Module decomposition</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</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">rulinalg</a>::<wbr><a href="../index.html">matrix</a>::<wbr><a class="mod" href="#">decomposition</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/matrix/decomposition/mod.rs.html#1-230">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>Decompositions for matrices.</p>
<p>This module houses the decomposition API of <code>rulinalg</code>.
A decomposition - or factorization - of a matrix is an
ordered set of <em>factors</em> such that when multiplied reconstructs
the original matrix. The <a href="trait.Decomposition.html">Decomposition</a>
trait encodes this property.</p>
<h2 id="the-decomposition-api"><a href="#the-decomposition-api">The decomposition API</a></h2>
<p>Decompositions in <code>rulinalg</code> are in general modeled after
the following:</p>
<ol>
<li>Given an appropriate matrix, an opaque decomposition object
may be computed which internally stores the factors
in an efficient and appropriate format.</li>
<li>In general, the factors may not be immediately available
as distinct matrices after decomposition. If the user
desires the explicit matrix factors involved in the
decomposition, the user must <code>unpack</code> the decomposition.</li>
<li>Before unpacking the decomposition, the decomposition
data structure in question may offer an API that provides
efficient implementations for some of the most common
applications of the decomposition. The user is encouraged
to use the decomposition-specific API rather than unpacking
the decompositions whenever possible.</li>
</ol>
<p>For a motivating example that explains the rationale behind
this design, let us consider the typical LU decomposition with
partial pivoting. In this case, given a square invertible matrix
<code>A</code>, one may find matrices <code>P</code>, <code>L</code> and <code>U</code> such that
<code>PA = LU</code>. Here <code>P</code> is a permutation matrix, <code>L</code> is a lower
triangular matrix and <code>U</code> is an upper triangular matrix.</p>
<p>Once the decomposition has been obtained, one of its applications
is the efficient solution of multiple similar linear systems.
Consider that while computing the LU decomposition requires
O(n<sup>3</sup>) floating point operations, the solution to
the system <code>Ax = b</code> can be computed in O(n<sup>2</sup>) floating
point operations if the LU decomposition has already been obtained.
Since the right-hand side <code>b</code> has no bearing on the LU decomposition,
it follows that one can efficiently solve this system for any <code>b</code>.</p>
<p>It turns out that the matrices <code>L</code> and <code>U</code> can be stored compactly
in the space of a single matrix. Indeed, this is how <code>PartialPivLu</code>
stores the LU decomposition internally. This allows <code>rulinalg</code> to
provide the user with efficient implementations of common applications
for the LU decomposition. However, the full matrix factors are easily
available to the user by unpacking the decomposition.</p>
<h2 id="available-decompositions"><a href="#available-decompositions">Available decompositions</a></h2>
<p><strong>The decompositions API is a work in progress.</strong></p>
<p>Currently, only a portion of the available decompositions in <code>rulinalg</code>
are available through the decomposition API. Please see the
<a href="../struct.Matrix.html">Matrix</a> API for the old decomposition
implementations that have yet not been implemented within
this framework.</p>
<table>
<thead>
<tr>
<th>Decomposition</th>
<th>Matrix requirements</th>
<th>Supported features</th>
</tr>
<tbody>
<tr>
<td><a href="struct.PartialPivLu.html">PartialPivLu</a></td>
<td>Square, invertible</td>
<td>
<ul>
<li>Linear system solving</li>
<li>Matrix inverse</li>
<li>Determinant computation</li>
</ul>
</td>
</tr>
<tr>
<td><a href="struct.FullPivLu.html">FullPivLu</a></td>
<td>Square matrices</td>
<td>
<ul>
<li>Linear system solving</li>
<li>Matrix inverse</li>
<li>Determinant computation</li>
<li>Rank computation</li>
</ul>
</td>
</tr>
<tr>
<td><a href="struct.Cholesky.html">Cholesky</a></td>
<td>Square, symmetric positive definite</td>
<td>
<ul>
<li>Linear system solving</li>
<li>Matrix inverse</li>
<li>Determinant computation</li>
</ul>
</td>
</tr>
<tr>
<td><a href="struct.HouseholderQr.html">HouseholderQr</a></td>
<td>Any matrix</td>
<td></td>
</tr>
</tbody>
</table></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.Cholesky.html" title="rulinalg::matrix::decomposition::Cholesky struct">Cholesky</a></div><div class="item-right docblock-short">Cholesky decomposition.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.FullPivLu.html" title="rulinalg::matrix::decomposition::FullPivLu struct">FullPivLu</a></div><div class="item-right docblock-short">LU decomposition with complete pivoting.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.HouseholderComposition.html" title="rulinalg::matrix::decomposition::HouseholderComposition struct">HouseholderComposition</a></div><div class="item-right docblock-short">An efficient representation for a composition of
Householder transformations.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.HouseholderQr.html" title="rulinalg::matrix::decomposition::HouseholderQr struct">HouseholderQr</a></div><div class="item-right docblock-short">QR decomposition based on Householder reflections.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.LUP.html" title="rulinalg::matrix::decomposition::LUP struct">LUP</a></div><div class="item-right docblock-short">Result of unpacking an instance of
<a href="struct.PartialPivLu.html">PartialPivLu</a>.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.LUPQ.html" title="rulinalg::matrix::decomposition::LUPQ struct">LUPQ</a></div><div class="item-right docblock-short">Result of unpacking an instance of
<a href="struct.FullPivLu.html">FullPivLu</a>.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.PartialPivLu.html" title="rulinalg::matrix::decomposition::PartialPivLu struct">PartialPivLu</a></div><div class="item-right docblock-short">LU decomposition with partial pivoting.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.QR.html" title="rulinalg::matrix::decomposition::QR struct">QR</a></div><div class="item-right docblock-short">The result of unpacking a QR decomposition.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ThinQR.html" title="rulinalg::matrix::decomposition::ThinQR struct">ThinQR</a></div><div class="item-right docblock-short">The result of computing a <em>thin</em> (or <em>reduced</em>) QR decomposition.</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.Decomposition.html" title="rulinalg::matrix::decomposition::Decomposition trait">Decomposition</a></div><div class="item-right docblock-short">Base trait for decompositions.</div></div></div></section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="rulinalg" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>