Travis CI
10 years ago
commit
a6dd9d03b0
52 changed files with 5125 additions and 0 deletions
-
0.lock
-
0.nojekyll
-
BINFiraSans-Medium.woff
-
BINFiraSans-Regular.woff
-
BINHeuristica-Italic.woff
-
BINSourceCodePro-Regular.woff
-
BINSourceCodePro-Semibold.woff
-
BINSourceSerifPro-Bold.woff
-
BINSourceSerifPro-Regular.woff
-
149complex/index.html
-
1complex/sidebar-items.js
-
136complex/struct.c32.html
-
136complex/struct.c64.html
-
142complex/trait.Complex.html
-
111complex/trait.Number.html
-
109complex/trait.Real.html
-
104dft/complex/fn.backward.html
-
104dft/complex/fn.forward.html
-
104dft/complex/fn.inverse.html
-
130dft/complex/index.html
-
1dft/complex/sidebar-items.js
-
121dft/index.html
-
105dft/real/fn.backward.html
-
115dft/real/fn.forward.html
-
105dft/real/fn.inverse.html
-
102dft/real/fn.unpack.html
-
139dft/real/index.html
-
1dft/real/sidebar-items.js
-
1dft/sidebar-items.js
-
10implementors/complex/trait.Complex.js
-
10implementors/complex/trait.Number.js
-
10implementors/complex/trait.Real.js
-
10implementors/core/clone/trait.Clone.js
-
10implementors/core/cmp/trait.PartialEq.js
-
10implementors/core/fmt/trait.Debug.js
-
10implementors/core/marker/trait.Copy.js
-
10implementors/core/ops/trait.Add.js
-
10implementors/core/ops/trait.Div.js
-
10implementors/core/ops/trait.Mul.js
-
10implementors/core/ops/trait.Neg.js
-
10implementors/core/ops/trait.Sub.js
-
4index.html
-
4jquery.js
-
660main.css
-
915main.js
-
1normalize.css
-
27playpen.js
-
4search-index.js
-
759src/complex/lib.rs.html
-
259src/dft/complex.rs.html
-
133src/dft/lib.rs.html
-
323src/dft/real.rs.html
@ -0,0 +1,149 @@ |
|||
<!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="API documentation for the Rust `complex` crate."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, complex"> |
|||
|
|||
<title>complex - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'></p><script>window.sidebarCurrent = {name: 'complex', ty: 'mod', relpath: '../'};</script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content mod"> |
|||
<h1 class='fqn'><span class='in-band'>Crate <a class='mod' href=''>complex</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-0' class='srclink' href='../src/complex/lib.rs.html#1-331' title='goto source code'>[src]</a></span></h1> |
|||
<div class='docblock'><p><a href="https://en.wikipedia.org/wiki/Complex_number">Complex numbers</a>.</p> |
|||
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2> |
|||
<table> |
|||
<tr class=' module-item'> |
|||
<td><a class='struct' href='struct.c32.html' |
|||
title='complex::c32'>c32</a></td> |
|||
<td class='docblock short'> |
|||
<p>A complex number with 32-bit parts.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
<tr class=' module-item'> |
|||
<td><a class='struct' href='struct.c64.html' |
|||
title='complex::c64'>c64</a></td> |
|||
<td class='docblock short'> |
|||
<p>A complex number with 64-bit parts.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
</table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2> |
|||
<table> |
|||
<tr class=' module-item'> |
|||
<td><a class='trait' href='trait.Complex.html' |
|||
title='complex::Complex'>Complex</a></td> |
|||
<td class='docblock short'> |
|||
<p>A complex number.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
<tr class=' module-item'> |
|||
<td><a class='trait' href='trait.Number.html' |
|||
title='complex::Number'>Number</a></td> |
|||
<td class='docblock short'> |
|||
<p>A number.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
<tr class=' module-item'> |
|||
<td><a class='trait' href='trait.Real.html' |
|||
title='complex::Real'>Real</a></td> |
|||
<td class='docblock short'> |
|||
<p>A real number.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
</table></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../"; |
|||
window.currentCrate = "complex"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../jquery.js"></script> |
|||
<script src="../main.js"></script> |
|||
|
|||
<script async src="../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1 @@ |
|||
initSidebarItems({"struct":[["c32","A complex number with 32-bit parts."],["c64","A complex number with 64-bit parts."]],"trait":[["Complex","A complex number."],["Number","A number."],["Real","A real number."]]}); |
@ -0,0 +1,136 @@ |
|||
<!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="API documentation for the Rust `c32` struct in crate `complex`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, c32"> |
|||
|
|||
<title>complex::c32 - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='index.html'>complex</a></p><script>window.sidebarCurrent = {name: 'c32', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content struct"> |
|||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>complex</a>::<wbr><a class='struct' href=''>c32</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-123' class='srclink' href='../src/complex/lib.rs.html#66' title='goto source code'>[src]</a></span></h1> |
|||
<pre class='rust struct'>pub struct c32(pub <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>, pub <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>);</pre><div class='docblock'><p>A complex number with 32-bit parts.</p> |
|||
</div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><code>impl <a class='trait' href='../complex/trait.Number.html' title='complex::Number'>Number</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'></div><h3 class='impl'><code>impl <a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Complex</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='assoc_type.Real' class='type'><code>type Real = <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a></code></h4> |
|||
<h4 id='method.new' class='method'><code>fn <a href='../complex/trait.Complex.html#method.new' class='fnname'>new</a>(re: Self::Real, im: Self::Real) -> <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h4> |
|||
<h4 id='method.from_polar' class='method'><code>fn <a href='../complex/trait.Complex.html#method.from_polar' class='fnname'>from_polar</a>(abs: Self::Real, arg: Self::Real) -> Self</code></h4> |
|||
<h4 id='method.re' class='method'><code>fn <a href='../complex/trait.Complex.html#method.re' class='fnname'>re</a>(&self) -> Self::Real</code></h4> |
|||
<h4 id='method.re_mut' class='method'><code>fn <a href='../complex/trait.Complex.html#method.re_mut' class='fnname'>re_mut</a>(&mut self) -> &mut Self::Real</code></h4> |
|||
<h4 id='method.im' class='method'><code>fn <a href='../complex/trait.Complex.html#method.im' class='fnname'>im</a>(&self) -> Self::Real</code></h4> |
|||
<h4 id='method.im_mut' class='method'><code>fn <a href='../complex/trait.Complex.html#method.im_mut' class='fnname'>im_mut</a>(&mut self) -> &mut Self::Real</code></h4> |
|||
<h4 id='method.abs' class='method'><code>fn <a href='../complex/trait.Complex.html#method.abs' class='fnname'>abs</a>(&self) -> Self::Real</code></h4> |
|||
<h4 id='method.arg' class='method'><code>fn <a href='../complex/trait.Complex.html#method.arg' class='fnname'>arg</a>(&self) -> Self::Real</code></h4> |
|||
<h4 id='method.to_polar' class='method'><code>fn <a href='../complex/trait.Complex.html#method.to_polar' class='fnname'>to_polar</a>(&self) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>)</a></code></h4> |
|||
<h4 id='method.conj' class='method'><code>fn <a href='../complex/trait.Complex.html#method.conj' class='fnname'>conj</a>(&self) -> Self</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html' title='core::ops::Add'>Add</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.add' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html#method.add' class='fnname'>add</a>(self, rhs: Self) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html' title='core::ops::Add'>Add</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.add' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html#method.add' class='fnname'>add</a>(self, rhs: <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html' title='core::ops::Div'>Div</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.div' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html#method.div' class='fnname'>div</a>(self, rhs: Self) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html' title='core::ops::Div'>Div</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.div' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html#method.div' class='fnname'>div</a>(self, rhs: <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html' title='core::ops::Mul'>Mul</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.mul' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html#method.mul' class='fnname'>mul</a>(self, rhs: Self) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html' title='core::ops::Mul'>Mul</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.mul' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html#method.mul' class='fnname'>mul</a>(self, rhs: <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Neg.html' title='core::ops::Neg'>Neg</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.neg' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Neg.html#method.neg' class='fnname'>neg</a>(self) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html' title='core::ops::Sub'>Sub</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.sub' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html#method.sub' class='fnname'>sub</a>(self, rhs: Self) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html' title='core::ops::Sub'>Sub</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.sub' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html#method.sub' class='fnname'>sub</a>(self, rhs: <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>) -> Self::Output</code></h4> |
|||
</div><h3 id='derived_implementations'>Derived Implementations </h3><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='method.eq' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.eq' class='fnname'>eq</a>(&self, __arg_0: &<a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a>) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4> |
|||
<h4 id='method.ne' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, __arg_0: &<a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a>) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='method.fmt' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#method.fmt' class='fnname'>fmt</a>(&self, __arg_0: &mut <a class='struct' href='http://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html' title='core::fmt::Formatter'>Formatter</a>) -> <a class='type' href='http://doc.rust-lang.org/nightly/core/fmt/type.Result.html' title='core::fmt::Result'>Result</a></code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/marker/trait.Copy.html' title='core::marker::Copy'>Copy</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'></div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h3><div class='impl-items'><h4 id='method.clone' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone' class='fnname'>clone</a>(&self) -> <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></h4> |
|||
<h4 id='method.clone_from' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: &Self)</code></h4> |
|||
</div></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../"; |
|||
window.currentCrate = "complex"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../jquery.js"></script> |
|||
<script src="../main.js"></script> |
|||
|
|||
<script async src="../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,136 @@ |
|||
<!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="API documentation for the Rust `c64` struct in crate `complex`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, c64"> |
|||
|
|||
<title>complex::c64 - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='index.html'>complex</a></p><script>window.sidebarCurrent = {name: 'c64', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content struct"> |
|||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>complex</a>::<wbr><a class='struct' href=''>c64</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-284' class='srclink' href='../src/complex/lib.rs.html#71' title='goto source code'>[src]</a></span></h1> |
|||
<pre class='rust struct'>pub struct c64(pub <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>, pub <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>);</pre><div class='docblock'><p>A complex number with 64-bit parts.</p> |
|||
</div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><code>impl <a class='trait' href='../complex/trait.Number.html' title='complex::Number'>Number</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'></div><h3 class='impl'><code>impl <a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Complex</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='assoc_type.Real' class='type'><code>type Real = <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a></code></h4> |
|||
<h4 id='method.new' class='method'><code>fn <a href='../complex/trait.Complex.html#method.new' class='fnname'>new</a>(re: Self::Real, im: Self::Real) -> <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h4> |
|||
<h4 id='method.from_polar' class='method'><code>fn <a href='../complex/trait.Complex.html#method.from_polar' class='fnname'>from_polar</a>(abs: Self::Real, arg: Self::Real) -> Self</code></h4> |
|||
<h4 id='method.re' class='method'><code>fn <a href='../complex/trait.Complex.html#method.re' class='fnname'>re</a>(&self) -> Self::Real</code></h4> |
|||
<h4 id='method.re_mut' class='method'><code>fn <a href='../complex/trait.Complex.html#method.re_mut' class='fnname'>re_mut</a>(&mut self) -> &mut Self::Real</code></h4> |
|||
<h4 id='method.im' class='method'><code>fn <a href='../complex/trait.Complex.html#method.im' class='fnname'>im</a>(&self) -> Self::Real</code></h4> |
|||
<h4 id='method.im_mut' class='method'><code>fn <a href='../complex/trait.Complex.html#method.im_mut' class='fnname'>im_mut</a>(&mut self) -> &mut Self::Real</code></h4> |
|||
<h4 id='method.abs' class='method'><code>fn <a href='../complex/trait.Complex.html#method.abs' class='fnname'>abs</a>(&self) -> Self::Real</code></h4> |
|||
<h4 id='method.arg' class='method'><code>fn <a href='../complex/trait.Complex.html#method.arg' class='fnname'>arg</a>(&self) -> Self::Real</code></h4> |
|||
<h4 id='method.to_polar' class='method'><code>fn <a href='../complex/trait.Complex.html#method.to_polar' class='fnname'>to_polar</a>(&self) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>)</a></code></h4> |
|||
<h4 id='method.conj' class='method'><code>fn <a href='../complex/trait.Complex.html#method.conj' class='fnname'>conj</a>(&self) -> Self</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html' title='core::ops::Add'>Add</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.add' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html#method.add' class='fnname'>add</a>(self, rhs: Self) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html' title='core::ops::Add'>Add</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.add' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html#method.add' class='fnname'>add</a>(self, rhs: <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html' title='core::ops::Div'>Div</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.div' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html#method.div' class='fnname'>div</a>(self, rhs: Self) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html' title='core::ops::Div'>Div</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.div' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html#method.div' class='fnname'>div</a>(self, rhs: <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html' title='core::ops::Mul'>Mul</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.mul' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html#method.mul' class='fnname'>mul</a>(self, rhs: Self) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html' title='core::ops::Mul'>Mul</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.mul' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html#method.mul' class='fnname'>mul</a>(self, rhs: <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Neg.html' title='core::ops::Neg'>Neg</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.neg' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Neg.html#method.neg' class='fnname'>neg</a>(self) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html' title='core::ops::Sub'>Sub</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.sub' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html#method.sub' class='fnname'>sub</a>(self, rhs: Self) -> Self::Output</code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html' title='core::ops::Sub'>Sub</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='assoc_type.Output' class='type'><code>type Output = Self</code></h4> |
|||
<h4 id='method.sub' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html#method.sub' class='fnname'>sub</a>(self, rhs: <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>) -> Self::Output</code></h4> |
|||
</div><h3 id='derived_implementations'>Derived Implementations </h3><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='method.eq' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.eq' class='fnname'>eq</a>(&self, __arg_0: &<a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a>) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4> |
|||
<h4 id='method.ne' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, __arg_0: &<a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a>) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='method.fmt' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#method.fmt' class='fnname'>fmt</a>(&self, __arg_0: &mut <a class='struct' href='http://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html' title='core::fmt::Formatter'>Formatter</a>) -> <a class='type' href='http://doc.rust-lang.org/nightly/core/fmt/type.Result.html' title='core::fmt::Result'>Result</a></code></h4> |
|||
</div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/marker/trait.Copy.html' title='core::marker::Copy'>Copy</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'></div><h3 class='impl'><code>impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h3><div class='impl-items'><h4 id='method.clone' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone' class='fnname'>clone</a>(&self) -> <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></h4> |
|||
<h4 id='method.clone_from' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: &Self)</code></h4> |
|||
</div></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../"; |
|||
window.currentCrate = "complex"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../jquery.js"></script> |
|||
<script src="../main.js"></script> |
|||
|
|||
<script async src="../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,142 @@ |
|||
<!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="API documentation for the Rust `Complex` trait in crate `complex`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, Complex"> |
|||
|
|||
<title>complex::Complex - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='index.html'>complex</a></p><script>window.sidebarCurrent = {name: 'Complex', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content trait"> |
|||
<h1 class='fqn'><span class='in-band'>Trait <a href='index.html'>complex</a>::<wbr><a class='trait' href=''>Complex</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-34' class='srclink' href='../src/complex/lib.rs.html#22-61' title='goto source code'>[src]</a></span></h1> |
|||
<pre class='rust trait'>pub trait Complex: <a class='trait' href='../complex/trait.Number.html' title='complex::Number'>Number</a> { |
|||
type Real: <a class='trait' href='../complex/trait.Real.html' title='complex::Real'>Real</a>; |
|||
fn <a href='#tymethod.new' class='fnname'>new</a>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>) -> Self; |
|||
fn <a href='#tymethod.from_polar' class='fnname'>from_polar</a>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>) -> Self; |
|||
fn <a href='#tymethod.re' class='fnname'>re</a>(&self) -> Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>; |
|||
fn <a href='#tymethod.re_mut' class='fnname'>re_mut</a>(&mut self) -> &mut Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>; |
|||
fn <a href='#tymethod.im' class='fnname'>im</a>(&self) -> Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>; |
|||
fn <a href='#tymethod.im_mut' class='fnname'>im_mut</a>(&mut self) -> &mut Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>; |
|||
fn <a href='#tymethod.abs' class='fnname'>abs</a>(&self) -> Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>; |
|||
fn <a href='#tymethod.arg' class='fnname'>arg</a>(&self) -> Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>; |
|||
|
|||
fn <a href='#method.to_polar' class='fnname'>to_polar</a>(&self) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>)</a> { ... } |
|||
fn <a href='#method.conj' class='fnname'>conj</a>(&self) -> Self { ... } |
|||
}</pre><div class='docblock'><p>A complex number.</p> |
|||
</div> |
|||
<h2 id='associated-types'>Associated Types</h2> |
|||
<div class='methods'> |
|||
<h3 id='associatedtype.Real' class='method stab '><code>type Real: <a class='trait' href='../complex/trait.Real.html' title='complex::Real'>Real</a></code></h3><div class='docblock'><p>A real number.</p> |
|||
</div></div> |
|||
<h2 id='required-methods'>Required Methods</h2> |
|||
<div class='methods'> |
|||
<h3 id='tymethod.new' class='method stab '><code>fn <a href='#tymethod.new' class='fnname'>new</a>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>) -> Self</code></h3><div class='docblock'><p>Create a complex number from a real and an imaginary part.</p> |
|||
</div><h3 id='tymethod.from_polar' class='method stab '><code>fn <a href='#tymethod.from_polar' class='fnname'>from_polar</a>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>) -> Self</code></h3><div class='docblock'><p>Create a complex number from a modulus and an argument.</p> |
|||
</div><h3 id='tymethod.re' class='method stab '><code>fn <a href='#tymethod.re' class='fnname'>re</a>(&self) -> Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a></code></h3><div class='docblock'><p>Return the real part.</p> |
|||
</div><h3 id='tymethod.re_mut' class='method stab '><code>fn <a href='#tymethod.re_mut' class='fnname'>re_mut</a>(&mut self) -> &mut Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a></code></h3><div class='docblock'><p>Return the real part as a mutable reference.</p> |
|||
</div><h3 id='tymethod.im' class='method stab '><code>fn <a href='#tymethod.im' class='fnname'>im</a>(&self) -> Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a></code></h3><div class='docblock'><p>Return the imaginary part.</p> |
|||
</div><h3 id='tymethod.im_mut' class='method stab '><code>fn <a href='#tymethod.im_mut' class='fnname'>im_mut</a>(&mut self) -> &mut Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a></code></h3><div class='docblock'><p>Return the imaginary part as a mutable reference.</p> |
|||
</div><h3 id='tymethod.abs' class='method stab '><code>fn <a href='#tymethod.abs' class='fnname'>abs</a>(&self) -> Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a></code></h3><div class='docblock'><p>Compute the modulus.</p> |
|||
</div><h3 id='tymethod.arg' class='method stab '><code>fn <a href='#tymethod.arg' class='fnname'>arg</a>(&self) -> Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a></code></h3><div class='docblock'><p>Compute the argument.</p> |
|||
</div></div> |
|||
<h2 id='provided-methods'>Provided Methods</h2> |
|||
<div class='methods'> |
|||
<h3 id='method.to_polar' class='method stab '><code>fn <a href='#method.to_polar' class='fnname'>to_polar</a>(&self) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>, Self::<a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Real</a>)</a></code></h3><div class='docblock'><p>Compute the modulus and the argument.</p> |
|||
</div><h3 id='method.conj' class='method stab '><code>fn <a href='#method.conj' class='fnname'>conj</a>(&self) -> Self</code></h3><div class='docblock'><p>Compute the complex conjugate.</p> |
|||
</div></div> |
|||
<h2 id='implementors'>Implementors</h2> |
|||
<ul class='item-list' id='implementors-list'> |
|||
<li><code>impl <a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Complex</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></li> |
|||
<li><code>impl <a class='trait' href='../complex/trait.Complex.html' title='complex::Complex'>Complex</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></li> |
|||
</ul><script type="text/javascript" async |
|||
src="../implementors/complex/trait.Complex.js"> |
|||
</script></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../"; |
|||
window.currentCrate = "complex"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../jquery.js"></script> |
|||
<script src="../main.js"></script> |
|||
|
|||
<script async src="../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,111 @@ |
|||
<!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="API documentation for the Rust `Number` trait in crate `complex`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, Number"> |
|||
|
|||
<title>complex::Number - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='index.html'>complex</a></p><script>window.sidebarCurrent = {name: 'Number', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content trait"> |
|||
<h1 class='fqn'><span class='in-band'>Trait <a href='index.html'>complex</a>::<wbr><a class='trait' href=''>Number</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-11' class='srclink' href='../src/complex/lib.rs.html#9-15' title='goto source code'>[src]</a></span></h1> |
|||
<pre class='rust trait'>pub trait Number: <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html' title='core::ops::Add'>Add</a><Output=Self> + <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html' title='core::ops::Div'>Div</a><Output=Self> + <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html' title='core::ops::Mul'>Mul</a><Output=Self> + <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Neg.html' title='core::ops::Neg'>Neg</a><Output=Self> + <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html' title='core::ops::Sub'>Sub</a><Output=Self> + <a class='trait' href='http://doc.rust-lang.org/nightly/core/marker/trait.Copy.html' title='core::marker::Copy'>Copy</a> + <a class='trait' href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> + <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a> { }</pre><div class='docblock'><p>A number.</p> |
|||
</div> |
|||
<h2 id='implementors'>Implementors</h2> |
|||
<ul class='item-list' id='implementors-list'> |
|||
<li><code>impl <a class='trait' href='../complex/trait.Number.html' title='complex::Number'>Number</a> for <a class='struct' href='../complex/struct.c32.html' title='complex::c32'>c32</a></code></li> |
|||
<li><code>impl <a class='trait' href='../complex/trait.Number.html' title='complex::Number'>Number</a> for <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a></code></li> |
|||
<li><code>impl <a class='trait' href='../complex/trait.Number.html' title='complex::Number'>Number</a> for <a class='struct' href='../complex/struct.c64.html' title='complex::c64'>c64</a></code></li> |
|||
<li><code>impl <a class='trait' href='../complex/trait.Number.html' title='complex::Number'>Number</a> for <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a></code></li> |
|||
</ul><script type="text/javascript" async |
|||
src="../implementors/complex/trait.Number.js"> |
|||
</script></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../"; |
|||
window.currentCrate = "complex"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../jquery.js"></script> |
|||
<script src="../main.js"></script> |
|||
|
|||
<script async src="../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,109 @@ |
|||
<!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="API documentation for the Rust `Real` trait in crate `complex`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, Real"> |
|||
|
|||
<title>complex::Real - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='index.html'>complex</a></p><script>window.sidebarCurrent = {name: 'Real', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content trait"> |
|||
<h1 class='fqn'><span class='in-band'>Trait <a href='index.html'>complex</a>::<wbr><a class='trait' href=''>Real</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-31' class='srclink' href='../src/complex/lib.rs.html#18-19' title='goto source code'>[src]</a></span></h1> |
|||
<pre class='rust trait'>pub trait Real: <a class='trait' href='../complex/trait.Number.html' title='complex::Number'>Number</a> { }</pre><div class='docblock'><p>A real number.</p> |
|||
</div> |
|||
<h2 id='implementors'>Implementors</h2> |
|||
<ul class='item-list' id='implementors-list'> |
|||
<li><code>impl <a class='trait' href='../complex/trait.Real.html' title='complex::Real'>Real</a> for <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a></code></li> |
|||
<li><code>impl <a class='trait' href='../complex/trait.Real.html' title='complex::Real'>Real</a> for <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a></code></li> |
|||
</ul><script type="text/javascript" async |
|||
src="../implementors/complex/trait.Real.js"> |
|||
</script></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../"; |
|||
window.currentCrate = "complex"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../jquery.js"></script> |
|||
<script src="../main.js"></script> |
|||
|
|||
<script async src="../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,104 @@ |
|||
<!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="API documentation for the Rust `backward` fn in crate `dft`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, backward"> |
|||
|
|||
<title>dft::complex::backward - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='../index.html'>dft</a>::<wbr><a href='index.html'>complex</a></p><script>window.sidebarCurrent = {name: 'backward', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content fn"> |
|||
<h1 class='fqn'><span class='in-band'>Function <a href='../index.html'>dft</a>::<wbr><a href='index.html'>complex</a>::<wbr><a class='fn' href=''>backward</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-64' class='srclink' href='../../src/dft/complex.rs.html#20-24' title='goto source code'>[src]</a></span></h1> |
|||
<pre class='rust fn'>pub fn backward(data: <a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>&mut [</a><a class='struct' href='../../complex/struct.c64.html' title='complex::c64'>c64</a><a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>)</pre><div class='docblock'><p>Perform the backward transform.</p> |
|||
|
|||
<p>The number of points should be a power of two.</p> |
|||
</div></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,104 @@ |
|||
<!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="API documentation for the Rust `forward` fn in crate `dft`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, forward"> |
|||
|
|||
<title>dft::complex::forward - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='../index.html'>dft</a>::<wbr><a href='index.html'>complex</a></p><script>window.sidebarCurrent = {name: 'forward', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content fn"> |
|||
<h1 class='fqn'><span class='in-band'>Function <a href='../index.html'>dft</a>::<wbr><a href='index.html'>complex</a>::<wbr><a class='fn' href=''>forward</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-8' class='srclink' href='../../src/dft/complex.rs.html#11-15' title='goto source code'>[src]</a></span></h1> |
|||
<pre class='rust fn'>pub fn forward(data: <a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>&mut [</a><a class='struct' href='../../complex/struct.c64.html' title='complex::c64'>c64</a><a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>)</pre><div class='docblock'><p>Perform the forward transform.</p> |
|||
|
|||
<p>The number of points should be a power of two.</p> |
|||
</div></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,104 @@ |
|||
<!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="API documentation for the Rust `inverse` fn in crate `dft`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, inverse"> |
|||
|
|||
<title>dft::complex::inverse - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='../index.html'>dft</a>::<wbr><a href='index.html'>complex</a></p><script>window.sidebarCurrent = {name: 'inverse', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content fn"> |
|||
<h1 class='fqn'><span class='in-band'>Function <a href='../index.html'>dft</a>::<wbr><a href='index.html'>complex</a>::<wbr><a class='fn' href=''>inverse</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-120' class='srclink' href='../../src/dft/complex.rs.html#29-34' title='goto source code'>[src]</a></span></h1> |
|||
<pre class='rust fn'>pub fn inverse(data: <a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>&mut [</a><a class='struct' href='../../complex/struct.c64.html' title='complex::c64'>c64</a><a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>)</pre><div class='docblock'><p>Perform the inverse transform.</p> |
|||
|
|||
<p>The number of points should be a power of two.</p> |
|||
</div></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,130 @@ |
|||
<!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="API documentation for the Rust `complex` mod in crate `dft`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, complex"> |
|||
|
|||
<title>dft::complex - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='../index.html'>dft</a></p><script>window.sidebarCurrent = {name: 'complex', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content mod"> |
|||
<h1 class='fqn'><span class='in-band'>Module <a href='../index.html'>dft</a>::<wbr><a class='mod' href=''>complex</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-5' class='srclink' href='../../src/dft/complex.rs.html#1-81' title='goto source code'>[src]</a></span></h1> |
|||
<div class='docblock'><p>Transformation of complex data.</p> |
|||
</div><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2> |
|||
<table> |
|||
<tr class=' module-item'> |
|||
<td><a class='fn' href='fn.backward.html' |
|||
title='dft::complex::backward'>backward</a></td> |
|||
<td class='docblock short'> |
|||
<p>Perform the backward transform.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
<tr class=' module-item'> |
|||
<td><a class='fn' href='fn.forward.html' |
|||
title='dft::complex::forward'>forward</a></td> |
|||
<td class='docblock short'> |
|||
<p>Perform the forward transform.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
<tr class=' module-item'> |
|||
<td><a class='fn' href='fn.inverse.html' |
|||
title='dft::complex::inverse'>inverse</a></td> |
|||
<td class='docblock short'> |
|||
<p>Perform the inverse transform.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
</table></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1 @@ |
|||
initSidebarItems({"fn":[["backward","Perform the backward transform."],["forward","Perform the forward transform."],["inverse","Perform the inverse transform."]]}); |
@ -0,0 +1,121 @@ |
|||
<!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="API documentation for the Rust `dft` crate."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, dft"> |
|||
|
|||
<title>dft - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'></p><script>window.sidebarCurrent = {name: 'dft', ty: 'mod', relpath: '../'};</script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content mod"> |
|||
<h1 class='fqn'><span class='in-band'>Crate <a class='mod' href=''>dft</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-0' class='srclink' href='../src/dft/lib.rs.html#1-18' title='goto source code'>[src]</a></span></h1> |
|||
<div class='docblock'><p><a href="https://en.wikipedia.org/wiki/Discrete_Fourier_transform">Discrete Fourier transform</a>.</p> |
|||
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2> |
|||
<table> |
|||
<tr class=' module-item'> |
|||
<td><a class='mod' href='complex/index.html' |
|||
title='dft::complex'>complex</a></td> |
|||
<td class='docblock short'> |
|||
<p>Transformation of complex data.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
<tr class=' module-item'> |
|||
<td><a class='mod' href='real/index.html' |
|||
title='dft::real'>real</a></td> |
|||
<td class='docblock short'> |
|||
<p>Transformation of real data.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
</table></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../jquery.js"></script> |
|||
<script src="../main.js"></script> |
|||
|
|||
<script async src="../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,105 @@ |
|||
<!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="API documentation for the Rust `backward` fn in crate `dft`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, backward"> |
|||
|
|||
<title>dft::real::backward - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='../index.html'>dft</a>::<wbr><a href='index.html'>real</a></p><script>window.sidebarCurrent = {name: 'backward', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content fn"> |
|||
<h1 class='fqn'><span class='in-band'>Function <a href='../index.html'>dft</a>::<wbr><a href='index.html'>real</a>::<wbr><a class='fn' href=''>backward</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-563' class='srclink' href='../../src/dft/real.rs.html#35-39' title='goto source code'>[src]</a></span></h1> |
|||
<pre class='rust fn'>pub fn backward(data: <a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>&mut [</a><a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a><a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>)</pre><div class='docblock'><p>Perform the backward transform.</p> |
|||
|
|||
<p>The number of points should be a power of two. The data should be packed as |
|||
described in <code>real::forward</code>.</p> |
|||
</div></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,115 @@ |
|||
<!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="API documentation for the Rust `forward` fn in crate `dft`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, forward"> |
|||
|
|||
<title>dft::real::forward - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='../index.html'>dft</a>::<wbr><a href='index.html'>real</a></p><script>window.sidebarCurrent = {name: 'forward', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content fn"> |
|||
<h1 class='fqn'><span class='in-band'>Function <a href='../index.html'>dft</a>::<wbr><a href='index.html'>real</a>::<wbr><a class='fn' href=''>forward</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-485' class='srclink' href='../../src/dft/real.rs.html#25-29' title='goto source code'>[src]</a></span></h1> |
|||
<pre class='rust fn'>pub fn forward(data: <a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>&mut [</a><a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a><a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>)</pre><div class='docblock'><p>Perform the forward transform.</p> |
|||
|
|||
<p>The number of points should be a power of two. The data are replaced by the |
|||
positive frequency half of their complex Fourier transform. The real-valued |
|||
first and last components of the complex transform are returned as elements |
|||
<code>data[0]</code> and <code>data[1]</code>, respectively.</p> |
|||
|
|||
<h2 id="references" class='section-header'><a |
|||
href="#references">References</a></h2> |
|||
<ol> |
|||
<li>William H. Press, Saul A. Teukolsky, William T. Vetterling, Brian P. |
|||
Flannery, “Numerical Recipes 3rd Edition: The Art of Scientific |
|||
Computing,” Cambridge University Press, 2007.</li> |
|||
</ol> |
|||
</div></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,105 @@ |
|||
<!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="API documentation for the Rust `inverse` fn in crate `dft`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, inverse"> |
|||
|
|||
<title>dft::real::inverse - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='../index.html'>dft</a>::<wbr><a href='index.html'>real</a></p><script>window.sidebarCurrent = {name: 'inverse', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content fn"> |
|||
<h1 class='fqn'><span class='in-band'>Function <a href='../index.html'>dft</a>::<wbr><a href='index.html'>real</a>::<wbr><a class='fn' href=''>inverse</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-641' class='srclink' href='../../src/dft/real.rs.html#45-49' title='goto source code'>[src]</a></span></h1> |
|||
<pre class='rust fn'>pub fn inverse(data: <a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>&mut [</a><a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a><a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>)</pre><div class='docblock'><p>Perform the inverse transform.</p> |
|||
|
|||
<p>The number of points should be a power of two. The data should be packed as |
|||
described in <code>real::forward</code>.</p> |
|||
</div></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,102 @@ |
|||
<!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="API documentation for the Rust `unpack` fn in crate `dft`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, unpack"> |
|||
|
|||
<title>dft::real::unpack - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='../index.html'>dft</a>::<wbr><a href='index.html'>real</a></p><script>window.sidebarCurrent = {name: 'unpack', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content fn"> |
|||
<h1 class='fqn'><span class='in-band'>Function <a href='../index.html'>dft</a>::<wbr><a href='index.html'>real</a>::<wbr><a class='fn' href=''>unpack</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-719' class='srclink' href='../../src/dft/real.rs.html#52-68' title='goto source code'>[src]</a></span></h1> |
|||
<pre class='rust fn'>pub fn unpack(data: <a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>&[</a><a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a><a href='http://doc.rust-lang.org/nightly/std/primitive.slice.html'>]</a>) -> <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='struct' href='../../complex/struct.c64.html' title='complex::c64'>c64</a>></pre><div class='docblock'><p>Unpack a compressed representation produced by <code>real::forward</code>.</p> |
|||
</div></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,139 @@ |
|||
<!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="API documentation for the Rust `real` mod in crate `dft`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang, real"> |
|||
|
|||
<title>dft::real - Rust</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
<p class='location'><a href='../index.html'>dft</a></p><script>window.sidebarCurrent = {name: 'real', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script> |
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content mod"> |
|||
<h1 class='fqn'><span class='in-band'>Module <a href='../index.html'>dft</a>::<wbr><a class='mod' href=''>real</a></span><span class='out-of-band'><span id='render-detail'> |
|||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> |
|||
[<span class='inner'>−</span>] |
|||
</a> |
|||
</span><a id='src-480' class='srclink' href='../../src/dft/real.rs.html#1-113' title='goto source code'>[src]</a></span></h1> |
|||
<div class='docblock'><p>Transformation of real data.</p> |
|||
</div><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2> |
|||
<table> |
|||
<tr class=' module-item'> |
|||
<td><a class='fn' href='fn.backward.html' |
|||
title='dft::real::backward'>backward</a></td> |
|||
<td class='docblock short'> |
|||
<p>Perform the backward transform.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
<tr class=' module-item'> |
|||
<td><a class='fn' href='fn.forward.html' |
|||
title='dft::real::forward'>forward</a></td> |
|||
<td class='docblock short'> |
|||
<p>Perform the forward transform.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
<tr class=' module-item'> |
|||
<td><a class='fn' href='fn.inverse.html' |
|||
title='dft::real::inverse'>inverse</a></td> |
|||
<td class='docblock short'> |
|||
<p>Perform the inverse transform.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
|
|||
<tr class=' module-item'> |
|||
<td><a class='fn' href='fn.unpack.html' |
|||
title='dft::real::unpack'>unpack</a></td> |
|||
<td class='docblock short'> |
|||
<p>Unpack a compressed representation produced by <code>real::forward</code>.</p> |
|||
|
|||
</td> |
|||
</tr> |
|||
</table></section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1 @@ |
|||
initSidebarItems({"fn":[["backward","Perform the backward transform."],["forward","Perform the forward transform."],["inverse","Perform the inverse transform."],["unpack","Unpack a compressed representation produced by `real::forward`."]]}); |
@ -0,0 +1 @@ |
|||
initSidebarItems({"mod":[["complex","Transformation of complex data."],["real","Transformation of real data."]]}); |
@ -0,0 +1,10 @@ |
|||
(function() {var implementors = {}; |
|||
implementors['complex'] = []; |
|||
|
|||
if (window.register_implementors) { |
|||
window.register_implementors(implementors); |
|||
} else { |
|||
window.pending_implementors = implementors; |
|||
} |
|||
|
|||
})() |
@ -0,0 +1,10 @@ |
|||
(function() {var implementors = {}; |
|||
implementors['complex'] = []; |
|||
|
|||
if (window.register_implementors) { |
|||
window.register_implementors(implementors); |
|||
} else { |
|||
window.pending_implementors = implementors; |
|||
} |
|||
|
|||
})() |
@ -0,0 +1,10 @@ |
|||
(function() {var implementors = {}; |
|||
implementors['complex'] = []; |
|||
|
|||
if (window.register_implementors) { |
|||
window.register_implementors(implementors); |
|||
} else { |
|||
window.pending_implementors = implementors; |
|||
} |
|||
|
|||
})() |
@ -0,0 +1,10 @@ |
|||
(function() {var implementors = {}; |
|||
implementors['complex'] = ["impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>",]; |
|||
|
|||
if (window.register_implementors) { |
|||
window.register_implementors(implementors); |
|||
} else { |
|||
window.pending_implementors = implementors; |
|||
} |
|||
|
|||
})() |
@ -0,0 +1,10 @@ |
|||
(function() {var implementors = {}; |
|||
implementors['complex'] = ["impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>",]; |
|||
|
|||
if (window.register_implementors) { |
|||
window.register_implementors(implementors); |
|||
} else { |
|||
window.pending_implementors = implementors; |
|||
} |
|||
|
|||
})() |
@ -0,0 +1,10 @@ |
|||
(function() {var implementors = {}; |
|||
implementors['complex'] = ["impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>",]; |
|||
|
|||
if (window.register_implementors) { |
|||
window.register_implementors(implementors); |
|||
} else { |
|||
window.pending_implementors = implementors; |
|||
} |
|||
|
|||
})() |
@ -0,0 +1,10 @@ |
|||
(function() {var implementors = {}; |
|||
implementors['complex'] = ["impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/marker/trait.Copy.html' title='core::marker::Copy'>Copy</a> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/marker/trait.Copy.html' title='core::marker::Copy'>Copy</a> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>",]; |
|||
|
|||
if (window.register_implementors) { |
|||
window.register_implementors(implementors); |
|||
} else { |
|||
window.pending_implementors = implementors; |
|||
} |
|||
|
|||
})() |
@ -0,0 +1,10 @@ |
|||
(function() {var implementors = {}; |
|||
implementors['complex'] = ["impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html' title='core::ops::Add'>Add</a> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html' title='core::ops::Add'>Add</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html' title='core::ops::Add'>Add</a><<a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>> for <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html' title='core::ops::Add'>Add</a> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html' title='core::ops::Add'>Add</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Add.html' title='core::ops::Add'>Add</a><<a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>> for <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>",]; |
|||
|
|||
if (window.register_implementors) { |
|||
window.register_implementors(implementors); |
|||
} else { |
|||
window.pending_implementors = implementors; |
|||
} |
|||
|
|||
})() |
@ -0,0 +1,10 @@ |
|||
(function() {var implementors = {}; |
|||
implementors['complex'] = ["impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html' title='core::ops::Div'>Div</a> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html' title='core::ops::Div'>Div</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html' title='core::ops::Div'>Div</a><<a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>> for <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html' title='core::ops::Div'>Div</a> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html' title='core::ops::Div'>Div</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Div.html' title='core::ops::Div'>Div</a><<a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>> for <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>",]; |
|||
|
|||
if (window.register_implementors) { |
|||
window.register_implementors(implementors); |
|||
} else { |
|||
window.pending_implementors = implementors; |
|||
} |
|||
|
|||
})() |
@ -0,0 +1,10 @@ |
|||
(function() {var implementors = {}; |
|||
implementors['complex'] = ["impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html' title='core::ops::Mul'>Mul</a> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html' title='core::ops::Mul'>Mul</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html' title='core::ops::Mul'>Mul</a><<a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>> for <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html' title='core::ops::Mul'>Mul</a> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html' title='core::ops::Mul'>Mul</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Mul.html' title='core::ops::Mul'>Mul</a><<a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>> for <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>",]; |
|||
|
|||
if (window.register_implementors) { |
|||
window.register_implementors(implementors); |
|||
} else { |
|||
window.pending_implementors = implementors; |
|||
} |
|||
|
|||
})() |
@ -0,0 +1,10 @@ |
|||
(function() {var implementors = {}; |
|||
implementors['complex'] = ["impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Neg.html' title='core::ops::Neg'>Neg</a> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Neg.html' title='core::ops::Neg'>Neg</a> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>",]; |
|||
|
|||
if (window.register_implementors) { |
|||
window.register_implementors(implementors); |
|||
} else { |
|||
window.pending_implementors = implementors; |
|||
} |
|||
|
|||
})() |
@ -0,0 +1,10 @@ |
|||
(function() {var implementors = {}; |
|||
implementors['complex'] = ["impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html' title='core::ops::Sub'>Sub</a> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html' title='core::ops::Sub'>Sub</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>> for <a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html' title='core::ops::Sub'>Sub</a><<a class='struct' href='complex/struct.c32.html' title='complex::c32'>c32</a>> for <a href='http://doc.rust-lang.org/nightly/std/primitive.f32.html'>f32</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html' title='core::ops::Sub'>Sub</a> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html' title='core::ops::Sub'>Sub</a><<a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>> for <a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>","impl <a class='trait' href='http://doc.rust-lang.org/nightly/core/ops/trait.Sub.html' title='core::ops::Sub'>Sub</a><<a class='struct' href='complex/struct.c64.html' title='complex::c64'>c64</a>> for <a href='http://doc.rust-lang.org/nightly/std/primitive.f64.html'>f64</a>",]; |
|||
|
|||
if (window.register_implementors) { |
|||
window.register_implementors(implementors); |
|||
} else { |
|||
window.pending_implementors = implementors; |
|||
} |
|||
|
|||
})() |
@ -0,0 +1,4 @@ |
|||
<!DOCTYPE html> |
|||
<link rel='canonical' href='dft/index.html'> |
|||
<meta http-equiv='refresh' content='0; url=dft/index.html'> |
|||
<script>window.location='dft/index.html'</script> |
4
jquery.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,660 @@ |
|||
/** |
|||
* Copyright 2013 The Rust Project Developers. See the COPYRIGHT |
|||
* file at the top-level directory of this distribution and at |
|||
* http://rust-lang.org/COPYRIGHT. |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
|||
* http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
|||
* <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
|||
* option. This file may not be copied, modified, or distributed |
|||
* except according to those terms. |
|||
*/ |
|||
@font-face { |
|||
font-family: 'Fira Sans'; |
|||
font-style: normal; |
|||
font-weight: 400; |
|||
src: local('Fira Sans'), url("FiraSans-Regular.woff") format('woff'); |
|||
} |
|||
@font-face { |
|||
font-family: 'Fira Sans'; |
|||
font-style: normal; |
|||
font-weight: 500; |
|||
src: local('Fira Sans Medium'), url("FiraSans-Medium.woff") format('woff'); |
|||
} |
|||
@font-face { |
|||
font-family: 'Source Serif Pro'; |
|||
font-style: normal; |
|||
font-weight: 400; |
|||
src: local('Source Serif Pro'), url("SourceSerifPro-Regular.woff") format('woff'); |
|||
} |
|||
@font-face { |
|||
font-family: 'Source Serif Pro'; |
|||
font-style: italic; |
|||
font-weight: 400; |
|||
src: url("Heuristica-Italic.woff") format('woff'); |
|||
} |
|||
@font-face { |
|||
font-family: 'Source Serif Pro'; |
|||
font-style: normal; |
|||
font-weight: 700; |
|||
src: local('Source Serif Pro Bold'), url("SourceSerifPro-Bold.woff") format('woff'); |
|||
} |
|||
@font-face { |
|||
font-family: 'Source Code Pro'; |
|||
font-style: normal; |
|||
font-weight: 400; |
|||
src: local('Source Code Pro'), url("SourceCodePro-Regular.woff") format('woff'); |
|||
} |
|||
@font-face { |
|||
font-family: 'Source Code Pro'; |
|||
font-style: normal; |
|||
font-weight: 600; |
|||
src: local('Source Code Pro Semibold'), url("SourceCodePro-Semibold.woff") format('woff'); |
|||
} |
|||
|
|||
@import "normalize.css"; |
|||
|
|||
* { |
|||
-webkit-box-sizing: border-box; |
|||
-moz-box-sizing: border-box; |
|||
box-sizing: border-box; |
|||
} |
|||
|
|||
/* General structure and fonts */ |
|||
|
|||
body { |
|||
color: #333; |
|||
font: 16px/1.4 "Source Serif Pro", Georgia, Times, "Times New Roman", serif; |
|||
margin: 0; |
|||
position: relative; |
|||
padding: 10px 15px 20px 15px; |
|||
|
|||
-webkit-font-feature-settings: "kern", "liga"; |
|||
-moz-font-feature-settings: "kern", "liga"; |
|||
font-feature-settings: "kern", "liga"; |
|||
} |
|||
|
|||
h1 { |
|||
font-size: 1.5em; |
|||
} |
|||
h2 { |
|||
font-size: 1.4em; |
|||
} |
|||
h3 { |
|||
font-size: 1.3em; |
|||
} |
|||
h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) { |
|||
color: black; |
|||
font-weight: 500; |
|||
margin: 20px 0 15px 0; |
|||
padding-bottom: 6px; |
|||
} |
|||
h1.fqn { |
|||
border-bottom: 1px dashed #D5D5D5; |
|||
margin-top: 0; |
|||
} |
|||
h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) { |
|||
border-bottom: 1px solid #DDDDDD; |
|||
} |
|||
h3.impl, h3.method, h4.method, h3.type, h4.type { |
|||
font-weight: 600; |
|||
margin-top: 10px; |
|||
margin-bottom: 10px; |
|||
} |
|||
h3.impl, h3.method, h3.type { |
|||
margin-top: 15px; |
|||
} |
|||
h1, h2, h3, h4, section.sidebar, a.source, .search-input, .content table :not(code)>a, .collapse-toggle { |
|||
font-family: "Fira Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; |
|||
} |
|||
|
|||
ol, ul { |
|||
padding-left: 25px; |
|||
} |
|||
ul ul, ol ul, ul ol, ol ol { |
|||
margin-bottom: 0; |
|||
} |
|||
|
|||
p { |
|||
margin: 0 0 .6em 0; |
|||
} |
|||
|
|||
code, pre { |
|||
font-family: "Source Code Pro", Menlo, Monaco, Consolas, "DejaVu Sans Mono", Inconsolata, monospace; |
|||
white-space: pre-wrap; |
|||
} |
|||
.docblock code { |
|||
background-color: #F5F5F5; |
|||
border-radius: 3px; |
|||
padding: 0 0.2em; |
|||
} |
|||
pre { |
|||
background-color: #F5F5F5; |
|||
padding: 14px; |
|||
} |
|||
|
|||
.source pre { |
|||
padding: 20px; |
|||
} |
|||
|
|||
.content.source { |
|||
margin-top: 50px; |
|||
max-width: none; |
|||
overflow: visible; |
|||
margin-left: 0px; |
|||
min-width: 70em; |
|||
} |
|||
|
|||
nav.sub { |
|||
font-size: 16px; |
|||
text-transform: uppercase; |
|||
} |
|||
|
|||
.sidebar { |
|||
width: 200px; |
|||
position: absolute; |
|||
left: 0; |
|||
top: 0; |
|||
min-height: 100%; |
|||
} |
|||
|
|||
.content, nav { max-width: 960px; } |
|||
|
|||
/* Everything else */ |
|||
|
|||
.js-only, .hidden { display: none; } |
|||
|
|||
.sidebar { |
|||
padding: 10px; |
|||
} |
|||
.sidebar img { |
|||
margin: 20px auto; |
|||
display: block; |
|||
} |
|||
|
|||
.sidebar .location { |
|||
font-size: 17px; |
|||
margin: 30px 0 20px 0; |
|||
background: #e1e1e1; |
|||
text-align: center; |
|||
color: #333; |
|||
} |
|||
|
|||
.location a:first-child { font-weight: 500; } |
|||
|
|||
.block { |
|||
padding: 0 10px; |
|||
margin-bottom: 14px; |
|||
} |
|||
.block h2 { |
|||
margin-top: 0; |
|||
margin-bottom: 8px; |
|||
text-align: center; |
|||
} |
|||
|
|||
.block a { |
|||
display: block; |
|||
text-overflow: ellipsis; |
|||
overflow: hidden; |
|||
line-height: 15px; |
|||
padding: 7px 5px; |
|||
font-size: 14px; |
|||
font-weight: 300; |
|||
transition: border 500ms ease-out; |
|||
} |
|||
|
|||
.block a:hover { |
|||
background: #F5F5F5; |
|||
} |
|||
|
|||
.content { |
|||
padding: 15px 0; |
|||
} |
|||
|
|||
.content.source pre.rust { |
|||
white-space: pre; |
|||
overflow: auto; |
|||
padding-left: 0; |
|||
} |
|||
.content pre.line-numbers { |
|||
float: left; |
|||
border: none; |
|||
position: relative; |
|||
|
|||
-webkit-user-select: none; |
|||
-moz-user-select: none; |
|||
-ms-user-select: none; |
|||
user-select: none; |
|||
} |
|||
.line-numbers span { color: #c67e2d; cursor: pointer; } |
|||
.line-numbers .line-highlighted { |
|||
background-color: #f6fdb0 !important; |
|||
} |
|||
|
|||
.content .highlighted { |
|||
color: #000 !important; |
|||
background-color: #ccc; |
|||
} |
|||
.content .highlighted a, .content .highlighted span { color: #000 !important; } |
|||
.content .highlighted.trait { background-color: #fece7e; } |
|||
.content .highlighted.mod { background-color: #afc6e4; } |
|||
.content .highlighted.enum { background-color: #b4d1b9; } |
|||
.content .highlighted.struct { background-color: #e7b1a0; } |
|||
.content .highlighted.fn { background-color: #c6afb3; } |
|||
.content .highlighted.method { background-color: #c6afb3; } |
|||
.content .highlighted.tymethod { background-color: #c6afb3; } |
|||
.content .highlighted.type { background-color: #c6afb3; } |
|||
|
|||
.docblock.short p { |
|||
display: inline; |
|||
} |
|||
|
|||
.docblock.short.nowrap { |
|||
display: block; |
|||
overflow: hidden; |
|||
white-space: nowrap; |
|||
text-overflow: ellipsis; |
|||
} |
|||
|
|||
.docblock.short p { |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
margin: 0; |
|||
} |
|||
.docblock.short code { white-space: nowrap; } |
|||
|
|||
.docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5 { |
|||
border-bottom: 1px solid #DDD; |
|||
} |
|||
|
|||
.docblock h1 { font-size: 1.3em; } |
|||
.docblock h2 { font-size: 1.15em; } |
|||
.docblock h3, .docblock h4, .docblock h5 { font-size: 1em; } |
|||
|
|||
.content .out-of-band { |
|||
font-size: 23px; |
|||
width: 40%; |
|||
margin: 0px; |
|||
padding: 0px; |
|||
text-align: right; |
|||
display: inline-block; |
|||
} |
|||
|
|||
.content .in-band { |
|||
width: 60%; |
|||
margin: 0px; |
|||
padding: 0px; |
|||
display: inline-block; |
|||
} |
|||
|
|||
.content table { |
|||
border-spacing: 0 5px; |
|||
border-collapse: separate; |
|||
} |
|||
.content td { vertical-align: top; } |
|||
.content td:first-child { padding-right: 20px; } |
|||
.content td p:first-child { margin-top: 0; } |
|||
.content td h1, .content td h2 { margin-left: 0; font-size: 1.1em; } |
|||
|
|||
.docblock table { |
|||
border: 1px solid #ddd; |
|||
margin: .5em 0; |
|||
border-collapse: collapse; |
|||
width: 100%; |
|||
} |
|||
|
|||
.docblock table td { |
|||
padding: .5em; |
|||
border-top: 1px dashed #ddd; |
|||
border-bottom: 1px dashed #ddd; |
|||
|
|||
} |
|||
|
|||
.docblock table th { |
|||
padding: .5em; |
|||
text-align: left; |
|||
border-top: 1px solid #ddd; |
|||
border-bottom: 1px solid #ddd; |
|||
} |
|||
|
|||
.content .item-list { |
|||
list-style-type: none; |
|||
padding: 0; |
|||
} |
|||
|
|||
.content .item-list li { margin-bottom: 3px; } |
|||
|
|||
.content .multi-column { |
|||
-moz-column-count: 5; |
|||
-moz-column-gap: 2.5em; |
|||
-webkit-column-count: 5; |
|||
-webkit-column-gap: 2.5em; |
|||
column-count: 5; |
|||
column-gap: 2.5em; |
|||
} |
|||
.content .multi-column li { width: 100%; display: inline-block; } |
|||
|
|||
.content .method { |
|||
font-size: 1em; |
|||
position: relative; |
|||
} |
|||
/* Shift "where ..." part of method definition down a line */ |
|||
.content .method .where { display: block; } |
|||
/* Bit of whitespace to indent it */ |
|||
.content .method .where::before { content: ' '; } |
|||
|
|||
.content .methods > div { margin-left: 40px; } |
|||
|
|||
.content .impl-items .docblock, .content .impl-items .stability { |
|||
margin-left: 40px; |
|||
} |
|||
.content .impl-items .method, .content .impl-items .type { |
|||
margin-left: 20px; |
|||
} |
|||
|
|||
nav { |
|||
border-bottom: 1px solid #e0e0e0; |
|||
padding-bottom: 10px; |
|||
margin-bottom: 10px; |
|||
} |
|||
nav.main { |
|||
padding: 20px 0; |
|||
text-align: center; |
|||
} |
|||
nav.main .current { |
|||
border-top: 1px solid #000; |
|||
border-bottom: 1px solid #000; |
|||
} |
|||
nav.main .separator { |
|||
border: 1px solid #000; |
|||
display: inline-block; |
|||
height: 23px; |
|||
margin: 0 20px; |
|||
} |
|||
nav.sum { text-align: right; } |
|||
nav.sub form { display: inline; } |
|||
|
|||
nav, .content { |
|||
margin-left: 230px; |
|||
} |
|||
|
|||
a { |
|||
text-decoration: none; |
|||
color: #000; |
|||
background: transparent; |
|||
} |
|||
|
|||
.docblock a { |
|||
color: #4e8bca; |
|||
} |
|||
|
|||
.docblock a:hover { |
|||
text-decoration: underline; |
|||
} |
|||
|
|||
.content span.trait, .content a.trait, .block a.current.trait { color: #8866ff; } |
|||
.content span.mod, .content a.mod, block a.current.mod { color: #4d76ae; } |
|||
.content span.enum, .content a.enum, .block a.current.enum { color: #5e9766; } |
|||
.content span.struct, .content a.struct, .block a.current.struct { color: #e53700; } |
|||
.content span.fn, .content a.fn, .block a.current.fn { color: #8c6067; } |
|||
.content span.method, .content a.method, .block a.current.method { color: #8c6067; } |
|||
.content span.tymethod, .content a.tymethod, .block a.current.tymethod { color: #8c6067; } |
|||
.content .fnname { color: #8c6067; } |
|||
|
|||
.search-input { |
|||
width: 100%; |
|||
/* Override Normalize.css: we have margins and do |
|||
not want to overflow - the `moz` attribute is necessary |
|||
until Firefox 29, too early to drop at this point */ |
|||
-moz-box-sizing: border-box !important; |
|||
box-sizing: border-box !important; |
|||
outline: none; |
|||
border: none; |
|||
border-radius: 1px; |
|||
color: #555; |
|||
margin-top: 5px; |
|||
padding: 10px 16px; |
|||
font-size: 17px; |
|||
box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent; |
|||
transition: border-color 300ms ease; |
|||
transition: border-radius 300ms ease-in-out; |
|||
transition: box-shadow 300ms ease-in-out; |
|||
} |
|||
|
|||
.search-input:focus { |
|||
border-color: #66afe9; |
|||
border-radius: 2px; |
|||
border: 0; |
|||
outline: 0; |
|||
box-shadow: 0 0 8px #078dd8; |
|||
} |
|||
|
|||
.search-results .desc { |
|||
white-space: nowrap; |
|||
text-overflow: ellipsis; |
|||
overflow: hidden; |
|||
display: block; |
|||
} |
|||
|
|||
.search-results a { |
|||
display: block; |
|||
} |
|||
|
|||
.content .search-results td:first-child { padding-right: 0; } |
|||
.content .search-results td:first-child a { padding-right: 10px; } |
|||
|
|||
#help { |
|||
background: #e9e9e9; |
|||
border-radius: 4px; |
|||
box-shadow: 0 0 6px rgba(0,0,0,.2); |
|||
position: absolute; |
|||
top: 300px; |
|||
left: 50%; |
|||
margin-top: -125px; |
|||
margin-left: -275px; |
|||
width: 550px; |
|||
height: 300px; |
|||
border: 1px solid #bfbfbf; |
|||
} |
|||
|
|||
#help dt { |
|||
float: left; |
|||
border-radius: 3px; |
|||
border: 1px solid #bfbfbf; |
|||
background: #fff; |
|||
width: 23px; |
|||
text-align: center; |
|||
clear: left; |
|||
display: block; |
|||
margin-top: -1px; |
|||
} |
|||
#help dd { margin: 5px 33px; } |
|||
#help .infos { padding-left: 0; } |
|||
#help h1 { margin-top: 0; } |
|||
#help div { |
|||
width: 50%; |
|||
float: left; |
|||
padding: 20px; |
|||
} |
|||
|
|||
em.stab.unstable { background: #FFF5D6; border-color: #FFC600; } |
|||
em.stab.deprecated { background: #F3DFFF; border-color: #7F0087; } |
|||
em.stab { |
|||
display: inline-block; |
|||
border-width: 1px; |
|||
border-style: solid; |
|||
padding: 3px; |
|||
margin-bottom: 5px; |
|||
font-size: 90%; |
|||
font-style: normal; |
|||
} |
|||
em.stab p { |
|||
display: inline; |
|||
} |
|||
|
|||
.module-item .stab { |
|||
border-width: 0; |
|||
padding: 0; |
|||
margin: 0; |
|||
background: inherit !important; |
|||
} |
|||
|
|||
.module-item.unstable { |
|||
opacity: 0.65; |
|||
} |
|||
|
|||
td.summary-column { |
|||
width: 100%; |
|||
} |
|||
|
|||
.summary { |
|||
padding-right: 0px; |
|||
} |
|||
|
|||
:target { background: #FDFFD3; } |
|||
.line-numbers :target { background-color: transparent; } |
|||
|
|||
/* Code highlighting */ |
|||
pre.rust .kw { color: #8959A8; } |
|||
pre.rust .kw-2, pre.rust .prelude-ty { color: #4271AE; } |
|||
pre.rust .number, pre.rust .string { color: #718C00; } |
|||
pre.rust .self, pre.rust .boolval, pre.rust .prelude-val, |
|||
pre.rust .attribute, pre.rust .attribute .ident { color: #C82829; } |
|||
pre.rust .comment { color: #8E908C; } |
|||
pre.rust .doccomment { color: #4D4D4C; } |
|||
pre.rust .macro, pre.rust .macro-nonterminal { color: #3E999F; } |
|||
pre.rust .lifetime { color: #B76514; } |
|||
|
|||
.rusttest { display: none; } |
|||
pre.rust { position: relative; } |
|||
.test-arrow { |
|||
display: inline-block; |
|||
position: absolute; |
|||
top: 0; |
|||
right: 10px; |
|||
font-size: 150%; |
|||
-webkit-transform: scaleX(-1); |
|||
transform: scaleX(-1); |
|||
} |
|||
|
|||
.methods .section-header { |
|||
/* Override parent class attributes. */ |
|||
border-bottom: none !important; |
|||
font-size: 1.1em !important; |
|||
margin: 0 0 -5px; |
|||
padding: 0; |
|||
} |
|||
|
|||
.section-header:hover a:after { |
|||
content: '\2002\00a7\2002'; |
|||
} |
|||
|
|||
.section-header:hover a { |
|||
text-decoration: none; |
|||
} |
|||
|
|||
.section-header a { |
|||
color: inherit; |
|||
} |
|||
|
|||
.collapse-toggle { |
|||
font-weight: 300; |
|||
position: absolute; |
|||
left: -23px; |
|||
color: #999; |
|||
top: 0; |
|||
} |
|||
|
|||
.toggle-wrapper > .collapse-toggle { |
|||
left: -24px; |
|||
margin-top: 0px; |
|||
} |
|||
|
|||
.toggle-wrapper { |
|||
position: relative; |
|||
} |
|||
|
|||
.toggle-wrapper.collapsed { |
|||
height: 1em; |
|||
transition: height .2s; |
|||
} |
|||
|
|||
.collapse-toggle > .inner { |
|||
display: inline-block; |
|||
width: 1.2ch; |
|||
text-align: center; |
|||
} |
|||
|
|||
.toggle-label { |
|||
color: #999; |
|||
} |
|||
|
|||
|
|||
|
|||
/* Media Queries */ |
|||
|
|||
@media (max-width: 700px) { |
|||
body { |
|||
padding-top: 0px; |
|||
} |
|||
|
|||
.sidebar { |
|||
height: 40px; |
|||
min-height: 40px; |
|||
width: 100%; |
|||
margin: 0px; |
|||
padding: 0px; |
|||
position: static; |
|||
} |
|||
|
|||
.sidebar .location { |
|||
float: left; |
|||
margin: 0px; |
|||
padding: 5px; |
|||
width: 60%; |
|||
background: inherit; |
|||
text-align: left; |
|||
font-size: 24px; |
|||
} |
|||
|
|||
.sidebar img { |
|||
width: 35px; |
|||
margin-top: 5px; |
|||
margin-bottom: 0px; |
|||
float: left; |
|||
} |
|||
|
|||
nav.sub { |
|||
margin: 0 auto; |
|||
} |
|||
|
|||
.sidebar .block { |
|||
display: none; |
|||
} |
|||
|
|||
.content { |
|||
margin-left: 0px; |
|||
} |
|||
|
|||
.content .in-band { |
|||
width: 100%; |
|||
} |
|||
|
|||
.content .out-of-band { |
|||
display: none; |
|||
} |
|||
|
|||
.toggle-wrapper > .collapse-toggle { |
|||
left: 0px; |
|||
} |
|||
|
|||
.toggle-wrapper { |
|||
height: 1.5em; |
|||
} |
|||
} |
|||
|
|||
@media print { |
|||
nav.sub, .content .out-of-band, .collapse-toggle { |
|||
display: none; |
|||
} |
|||
} |
@ -0,0 +1,915 @@ |
|||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|||
// file at the top-level directory of this distribution and at
|
|||
// http://rust-lang.org/COPYRIGHT.
|
|||
//
|
|||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|||
// option. This file may not be copied, modified, or distributed
|
|||
// except according to those terms.
|
|||
|
|||
/*jslint browser: true, es5: true */ |
|||
/*globals $: true, rootPath: true */ |
|||
|
|||
(function() { |
|||
"use strict"; |
|||
var resizeTimeout, interval; |
|||
|
|||
// This mapping table should match the discriminants of
|
|||
// `rustdoc::html::item_type::ItemType` type in Rust.
|
|||
var itemTypes = ["mod", |
|||
"externcrate", |
|||
"import", |
|||
"struct", |
|||
"enum", |
|||
"fn", |
|||
"type", |
|||
"static", |
|||
"trait", |
|||
"impl", |
|||
"tymethod", |
|||
"method", |
|||
"structfield", |
|||
"variant", |
|||
"macro", |
|||
"primitive", |
|||
"associatedtype", |
|||
"constant", |
|||
"associatedconstant"]; |
|||
|
|||
$('.js-only').removeClass('js-only'); |
|||
|
|||
function getQueryStringParams() { |
|||
var params = {}; |
|||
window.location.search.substring(1).split("&"). |
|||
map(function(s) { |
|||
var pair = s.split("="); |
|||
params[decodeURIComponent(pair[0])] = |
|||
typeof pair[1] === "undefined" ? |
|||
null : decodeURIComponent(pair[1]); |
|||
}); |
|||
return params; |
|||
} |
|||
|
|||
function browserSupportsHistoryApi() { |
|||
return window.history && typeof window.history.pushState === "function"; |
|||
} |
|||
|
|||
function highlightSourceLines(ev) { |
|||
var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/); |
|||
if (match) { |
|||
from = parseInt(match[1], 10); |
|||
to = Math.min(50000, parseInt(match[2] || match[1], 10)); |
|||
from = Math.min(from, to); |
|||
if ($('#' + from).length === 0) { |
|||
return; |
|||
} |
|||
if (ev === null) $('#' + from)[0].scrollIntoView(); |
|||
$('.line-numbers span').removeClass('line-highlighted'); |
|||
for (i = from; i <= to; ++i) { |
|||
$('#' + i).addClass('line-highlighted'); |
|||
} |
|||
} |
|||
} |
|||
highlightSourceLines(null); |
|||
$(window).on('hashchange', highlightSourceLines); |
|||
|
|||
$(document).on('keyup', function(e) { |
|||
if (document.activeElement.tagName === 'INPUT') { |
|||
return; |
|||
} |
|||
|
|||
if (e.which === 191) { // question mark
|
|||
if (e.shiftKey && $('#help').hasClass('hidden')) { |
|||
e.preventDefault(); |
|||
$('#help').removeClass('hidden'); |
|||
} |
|||
} else if (e.which === 27) { // esc
|
|||
if (!$('#help').hasClass('hidden')) { |
|||
e.preventDefault(); |
|||
$('#help').addClass('hidden'); |
|||
} else if (!$('#search').hasClass('hidden')) { |
|||
e.preventDefault(); |
|||
$('#search').addClass('hidden'); |
|||
$('#main').removeClass('hidden'); |
|||
} |
|||
} else if (e.which === 83) { // S
|
|||
e.preventDefault(); |
|||
$('.search-input').focus(); |
|||
} |
|||
}).on('click', function(e) { |
|||
if (!$(e.target).closest('#help').length) { |
|||
$('#help').addClass('hidden'); |
|||
} |
|||
}); |
|||
|
|||
$('.version-selector').on('change', function() { |
|||
var i, match, |
|||
url = document.location.href, |
|||
stripped = '', |
|||
len = rootPath.match(/\.\.\//g).length + 1; |
|||
|
|||
for (i = 0; i < len; ++i) { |
|||
match = url.match(/\/[^\/]*$/); |
|||
if (i < len - 1) { |
|||
stripped = match[0] + stripped; |
|||
} |
|||
url = url.substring(0, url.length - match[0].length); |
|||
} |
|||
|
|||
url += '/' + $('.version-selector').val() + stripped; |
|||
|
|||
document.location.href = url; |
|||
}); |
|||
/** |
|||
* A function to compute the Levenshtein distance between two strings |
|||
* Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported |
|||
* Full License can be found at http://creativecommons.org/licenses/by-sa/3.0/legalcode
|
|||
* This code is an unmodified version of the code written by Marco de Wit |
|||
* and was found at http://stackoverflow.com/a/18514751/745719
|
|||
*/ |
|||
var levenshtein = (function() { |
|||
var row2 = []; |
|||
return function(s1, s2) { |
|||
if (s1 === s2) { |
|||
return 0; |
|||
} else { |
|||
var s1_len = s1.length, s2_len = s2.length; |
|||
if (s1_len && s2_len) { |
|||
var i1 = 0, i2 = 0, a, b, c, c2, row = row2; |
|||
while (i1 < s1_len) |
|||
row[i1] = ++i1; |
|||
while (i2 < s2_len) { |
|||
c2 = s2.charCodeAt(i2); |
|||
a = i2; |
|||
++i2; |
|||
b = i2; |
|||
for (i1 = 0; i1 < s1_len; ++i1) { |
|||
c = a + (s1.charCodeAt(i1) !== c2 ? 1 : 0); |
|||
a = row[i1]; |
|||
b = b < a ? (b < c ? b + 1 : c) : (a < c ? a + 1 : c); |
|||
row[i1] = b; |
|||
} |
|||
} |
|||
return b; |
|||
} else { |
|||
return s1_len + s2_len; |
|||
} |
|||
} |
|||
}; |
|||
})(); |
|||
|
|||
function initSearch(rawSearchIndex) { |
|||
var currentResults, index, searchIndex; |
|||
var MAX_LEV_DISTANCE = 3; |
|||
var params = getQueryStringParams(); |
|||
|
|||
// Populate search bar with query string search term when provided,
|
|||
// but only if the input bar is empty. This avoid the obnoxious issue
|
|||
// where you start trying to do a search, and the index loads, and
|
|||
// suddenly your search is gone!
|
|||
if ($(".search-input")[0].value === "") { |
|||
$(".search-input")[0].value = params.search || ''; |
|||
} |
|||
|
|||
/** |
|||
* Executes the query and builds an index of results |
|||
* @param {[Object]} query [The user query] |
|||
* @param {[type]} max [The maximum results returned] |
|||
* @param {[type]} searchWords [The list of search words to query |
|||
* against] |
|||
* @return {[type]} [A search index of results] |
|||
*/ |
|||
function execQuery(query, max, searchWords) { |
|||
var valLower = query.query.toLowerCase(), |
|||
val = valLower, |
|||
typeFilter = itemTypeFromName(query.type), |
|||
results = [], |
|||
split = valLower.split("::"); |
|||
|
|||
//remove empty keywords
|
|||
for (var j = 0; j < split.length; ++j) { |
|||
split[j].toLowerCase(); |
|||
if (split[j] === "") { |
|||
split.splice(j, 1); |
|||
} |
|||
} |
|||
|
|||
// quoted values mean literal search
|
|||
var nSearchWords = searchWords.length; |
|||
if ((val.charAt(0) === "\"" || val.charAt(0) === "'") && |
|||
val.charAt(val.length - 1) === val.charAt(0)) |
|||
{ |
|||
val = val.substr(1, val.length - 2); |
|||
for (var i = 0; i < nSearchWords; ++i) { |
|||
if (searchWords[i] === val) { |
|||
// filter type: ... queries
|
|||
if (typeFilter < 0 || typeFilter === searchIndex[i].ty) { |
|||
results.push({id: i, index: -1}); |
|||
} |
|||
} |
|||
if (results.length === max) { |
|||
break; |
|||
} |
|||
} |
|||
// searching by type
|
|||
} else if (val.search("->") > -1) { |
|||
var trimmer = function (s) { return s.trim(); }; |
|||
var parts = val.split("->").map(trimmer); |
|||
var input = parts[0]; |
|||
// sort inputs so that order does not matter
|
|||
var inputs = input.split(",").map(trimmer).sort(); |
|||
var output = parts[1]; |
|||
|
|||
for (var i = 0; i < nSearchWords; ++i) { |
|||
var type = searchIndex[i].type; |
|||
if (!type) { |
|||
continue; |
|||
} |
|||
|
|||
// sort index inputs so that order does not matter
|
|||
var typeInputs = type.inputs.map(function (input) { |
|||
return input.name; |
|||
}).sort(); |
|||
|
|||
// allow searching for void (no output) functions as well
|
|||
var typeOutput = type.output ? type.output.name : ""; |
|||
if (inputs.toString() === typeInputs.toString() && |
|||
output == typeOutput) { |
|||
results.push({id: i, index: -1, dontValidate: true}); |
|||
} |
|||
} |
|||
} else { |
|||
// gather matching search results up to a certain maximum
|
|||
val = val.replace(/\_/g, ""); |
|||
for (var i = 0; i < split.length; ++i) { |
|||
for (var j = 0; j < nSearchWords; ++j) { |
|||
var lev_distance; |
|||
if (searchWords[j].indexOf(split[i]) > -1 || |
|||
searchWords[j].indexOf(val) > -1 || |
|||
searchWords[j].replace(/_/g, "").indexOf(val) > -1) |
|||
{ |
|||
// filter type: ... queries
|
|||
if (typeFilter < 0 || typeFilter === searchIndex[j].ty) { |
|||
results.push({ |
|||
id: j, |
|||
index: searchWords[j].replace(/_/g, "").indexOf(val), |
|||
lev: 0, |
|||
}); |
|||
} |
|||
} else if ( |
|||
(lev_distance = levenshtein(searchWords[j], val)) <= |
|||
MAX_LEV_DISTANCE) { |
|||
if (typeFilter < 0 || typeFilter === searchIndex[j].ty) { |
|||
results.push({ |
|||
id: j, |
|||
index: 0, |
|||
// we want lev results to go lower than others
|
|||
lev: lev_distance, |
|||
}); |
|||
} |
|||
} |
|||
if (results.length === max) { |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
var nresults = results.length; |
|||
for (var i = 0; i < nresults; ++i) { |
|||
results[i].word = searchWords[results[i].id]; |
|||
results[i].item = searchIndex[results[i].id] || {}; |
|||
} |
|||
// if there are no results then return to default and fail
|
|||
if (results.length === 0) { |
|||
return []; |
|||
} |
|||
|
|||
results.sort(function(aaa, bbb) { |
|||
var a, b; |
|||
|
|||
// Sort by non levenshtein results and then levenshtein results by the distance
|
|||
// (less changes required to match means higher rankings)
|
|||
a = (aaa.lev); |
|||
b = (bbb.lev); |
|||
if (a !== b) return a - b; |
|||
|
|||
// sort by crate (non-current crate goes later)
|
|||
a = (aaa.item.crate !== window.currentCrate); |
|||
b = (bbb.item.crate !== window.currentCrate); |
|||
if (a !== b) return a - b; |
|||
|
|||
// sort by exact match (mismatch goes later)
|
|||
a = (aaa.word !== valLower); |
|||
b = (bbb.word !== valLower); |
|||
if (a !== b) return a - b; |
|||
|
|||
// sort by item name length (longer goes later)
|
|||
a = aaa.word.length; |
|||
b = bbb.word.length; |
|||
if (a !== b) return a - b; |
|||
|
|||
// sort by item name (lexicographically larger goes later)
|
|||
a = aaa.word; |
|||
b = bbb.word; |
|||
if (a !== b) return (a > b ? +1 : -1); |
|||
|
|||
// sort by index of keyword in item name (no literal occurrence goes later)
|
|||
a = (aaa.index < 0); |
|||
b = (bbb.index < 0); |
|||
if (a !== b) return a - b; |
|||
// (later literal occurrence, if any, goes later)
|
|||
a = aaa.index; |
|||
b = bbb.index; |
|||
if (a !== b) return a - b; |
|||
|
|||
// sort by description (no description goes later)
|
|||
a = (aaa.item.desc === ''); |
|||
b = (bbb.item.desc === ''); |
|||
if (a !== b) return a - b; |
|||
|
|||
// sort by type (later occurrence in `itemTypes` goes later)
|
|||
a = aaa.item.ty; |
|||
b = bbb.item.ty; |
|||
if (a !== b) return a - b; |
|||
|
|||
// sort by path (lexicographically larger goes later)
|
|||
a = aaa.item.path; |
|||
b = bbb.item.path; |
|||
if (a !== b) return (a > b ? +1 : -1); |
|||
|
|||
// que sera, sera
|
|||
return 0; |
|||
}); |
|||
|
|||
// remove duplicates, according to the data provided
|
|||
for (var i = results.length - 1; i > 0; i -= 1) { |
|||
if (results[i].word === results[i - 1].word && |
|||
results[i].item.ty === results[i - 1].item.ty && |
|||
results[i].item.path === results[i - 1].item.path && |
|||
(results[i].item.parent || {}).name === (results[i - 1].item.parent || {}).name) |
|||
{ |
|||
results[i].id = -1; |
|||
} |
|||
} |
|||
for (var i = 0; i < results.length; ++i) { |
|||
var result = results[i], |
|||
name = result.item.name.toLowerCase(), |
|||
path = result.item.path.toLowerCase(), |
|||
parent = result.item.parent; |
|||
|
|||
// this validation does not make sense when searching by types
|
|||
if (result.dontValidate) { |
|||
continue; |
|||
} |
|||
|
|||
var valid = validateResult(name, path, split, parent); |
|||
if (!valid) { |
|||
result.id = -1; |
|||
} |
|||
} |
|||
return results; |
|||
} |
|||
|
|||
/** |
|||
* Validate performs the following boolean logic. For example: |
|||
* "File::open" will give IF A PARENT EXISTS => ("file" && "open") |
|||
* exists in (name || path || parent) OR => ("file" && "open") exists in |
|||
* (name || path ) |
|||
* |
|||
* This could be written functionally, but I wanted to minimise |
|||
* functions on stack. |
|||
* |
|||
* @param {[string]} name [The name of the result] |
|||
* @param {[string]} path [The path of the result] |
|||
* @param {[string]} keys [The keys to be used (["file", "open"])] |
|||
* @param {[object]} parent [The parent of the result] |
|||
* @return {[boolean]} [Whether the result is valid or not] |
|||
*/ |
|||
function validateResult(name, path, keys, parent) { |
|||
for (var i=0; i < keys.length; ++i) { |
|||
// each check is for validation so we negate the conditions and invalidate
|
|||
if (!( |
|||
// check for an exact name match
|
|||
name.toLowerCase().indexOf(keys[i]) > -1 || |
|||
// then an exact path match
|
|||
path.toLowerCase().indexOf(keys[i]) > -1 || |
|||
// next if there is a parent, check for exact parent match
|
|||
(parent !== undefined && |
|||
parent.name.toLowerCase().indexOf(keys[i]) > -1) || |
|||
// lastly check to see if the name was a levenshtein match
|
|||
levenshtein(name.toLowerCase(), keys[i]) <= |
|||
MAX_LEV_DISTANCE)) { |
|||
return false; |
|||
} |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
function getQuery() { |
|||
var matches, type, query, raw = $('.search-input').val(); |
|||
query = raw; |
|||
|
|||
matches = query.match(/^(fn|mod|struct|enum|trait|t(ype)?d(ef)?)\s*:\s*/i); |
|||
if (matches) { |
|||
type = matches[1].replace(/^td$/, 'typedef') |
|||
.replace(/^tdef$/, 'typedef') |
|||
.replace(/^typed$/, 'typedef'); |
|||
query = query.substring(matches[0].length); |
|||
} |
|||
|
|||
return { |
|||
raw: raw, |
|||
query: query, |
|||
type: type, |
|||
id: query + type, |
|||
}; |
|||
} |
|||
|
|||
function initSearchNav() { |
|||
var hoverTimeout, $results = $('.search-results .result'); |
|||
|
|||
$results.on('click', function() { |
|||
var dst = $(this).find('a')[0]; |
|||
if (window.location.pathname == dst.pathname) { |
|||
$('#search').addClass('hidden'); |
|||
$('#main').removeClass('hidden'); |
|||
document.location.href = dst.href; |
|||
} |
|||
}).on('mouseover', function() { |
|||
var $el = $(this); |
|||
clearTimeout(hoverTimeout); |
|||
hoverTimeout = setTimeout(function() { |
|||
$results.removeClass('highlighted'); |
|||
$el.addClass('highlighted'); |
|||
}, 20); |
|||
}); |
|||
|
|||
$(document).off('keydown.searchnav'); |
|||
$(document).on('keydown.searchnav', function(e) { |
|||
var $active = $results.filter('.highlighted'); |
|||
|
|||
if (e.which === 38) { // up
|
|||
e.preventDefault(); |
|||
if (!$active.length || !$active.prev()) { |
|||
return; |
|||
} |
|||
|
|||
$active.prev().addClass('highlighted'); |
|||
$active.removeClass('highlighted'); |
|||
} else if (e.which === 40) { // down
|
|||
e.preventDefault(); |
|||
if (!$active.length) { |
|||
$results.first().addClass('highlighted'); |
|||
} else if ($active.next().length) { |
|||
$active.next().addClass('highlighted'); |
|||
$active.removeClass('highlighted'); |
|||
} |
|||
} else if (e.which === 13) { // return
|
|||
e.preventDefault(); |
|||
if ($active.length) { |
|||
document.location.href = $active.find('a').prop('href'); |
|||
} |
|||
} else { |
|||
$active.removeClass('highlighted'); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
function escape(content) { |
|||
return $('<h1/>').text(content).html(); |
|||
} |
|||
|
|||
function showResults(results) { |
|||
var output, shown, query = getQuery(); |
|||
|
|||
currentResults = query.id; |
|||
output = '<h1>Results for ' + escape(query.query) + |
|||
(query.type ? ' (type: ' + escape(query.type) + ')' : '') + '</h1>'; |
|||
output += '<table class="search-results">'; |
|||
|
|||
if (results.length > 0) { |
|||
shown = []; |
|||
|
|||
results.forEach(function(item) { |
|||
var name, type, href, displayPath; |
|||
|
|||
if (shown.indexOf(item) !== -1) { |
|||
return; |
|||
} |
|||
|
|||
shown.push(item); |
|||
name = item.name; |
|||
type = itemTypes[item.ty]; |
|||
|
|||
if (type === 'mod') { |
|||
displayPath = item.path + '::'; |
|||
href = rootPath + item.path.replace(/::/g, '/') + '/' + |
|||
name + '/index.html'; |
|||
} else if (type === 'static' || type === 'reexport') { |
|||
displayPath = item.path + '::'; |
|||
href = rootPath + item.path.replace(/::/g, '/') + |
|||
'/index.html'; |
|||
} else if (item.parent !== undefined) { |
|||
var myparent = item.parent; |
|||
var anchor = '#' + type + '.' + name; |
|||
displayPath = item.path + '::' + myparent.name + '::'; |
|||
href = rootPath + item.path.replace(/::/g, '/') + |
|||
'/' + itemTypes[myparent.ty] + |
|||
'.' + myparent.name + |
|||
'.html' + anchor; |
|||
} else { |
|||
displayPath = item.path + '::'; |
|||
href = rootPath + item.path.replace(/::/g, '/') + |
|||
'/' + type + '.' + name + '.html'; |
|||
} |
|||
|
|||
output += '<tr class="' + type + ' result"><td>' + |
|||
'<a href="' + href + '">' + |
|||
displayPath + '<span class="' + type + '">' + |
|||
name + '</span></a></td><td>' + |
|||
'<a href="' + href + '">' + |
|||
'<span class="desc">' + item.desc + |
|||
' </span></a></td></tr>'; |
|||
}); |
|||
} else { |
|||
output += 'No results :( <a href="https://duckduckgo.com/?q=' + |
|||
encodeURIComponent('rust ' + query.query) + |
|||
'">Try on DuckDuckGo?</a>'; |
|||
} |
|||
|
|||
output += "</p>"; |
|||
$('#main.content').addClass('hidden'); |
|||
$('#search.content').removeClass('hidden').html(output); |
|||
$('#search .desc').width($('#search').width() - 40 - |
|||
$('#search td:first-child').first().width()); |
|||
initSearchNav(); |
|||
} |
|||
|
|||
function search(e) { |
|||
var query, |
|||
filterdata = [], |
|||
obj, i, len, |
|||
results = [], |
|||
maxResults = 200, |
|||
resultIndex; |
|||
var params = getQueryStringParams(); |
|||
|
|||
query = getQuery(); |
|||
if (e) { |
|||
e.preventDefault(); |
|||
} |
|||
|
|||
if (!query.query || query.id === currentResults) { |
|||
return; |
|||
} |
|||
|
|||
// Because searching is incremental by character, only the most
|
|||
// recent search query is added to the browser history.
|
|||
if (browserSupportsHistoryApi()) { |
|||
if (!history.state && !params.search) { |
|||
history.pushState(query, "", "?search=" + |
|||
encodeURIComponent(query.raw)); |
|||
} else { |
|||
history.replaceState(query, "", "?search=" + |
|||
encodeURIComponent(query.raw)); |
|||
} |
|||
} |
|||
|
|||
resultIndex = execQuery(query, 20000, index); |
|||
len = resultIndex.length; |
|||
for (i = 0; i < len; ++i) { |
|||
if (resultIndex[i].id > -1) { |
|||
obj = searchIndex[resultIndex[i].id]; |
|||
filterdata.push([obj.name, obj.ty, obj.path, obj.desc]); |
|||
results.push(obj); |
|||
} |
|||
if (results.length >= maxResults) { |
|||
break; |
|||
} |
|||
} |
|||
|
|||
showResults(results); |
|||
} |
|||
|
|||
function itemTypeFromName(typename) { |
|||
for (var i = 0; i < itemTypes.length; ++i) { |
|||
if (itemTypes[i] === typename) return i; |
|||
} |
|||
return -1; |
|||
} |
|||
|
|||
function buildIndex(rawSearchIndex) { |
|||
searchIndex = []; |
|||
var searchWords = []; |
|||
for (var crate in rawSearchIndex) { |
|||
if (!rawSearchIndex.hasOwnProperty(crate)) { continue } |
|||
|
|||
// an array of [(Number) item type,
|
|||
// (String) name,
|
|||
// (String) full path or empty string for previous path,
|
|||
// (String) description,
|
|||
// (Number | null) the parent path index to `paths`]
|
|||
// (Object | null) the type of the function (if any)
|
|||
var items = rawSearchIndex[crate].items; |
|||
// an array of [(Number) item type,
|
|||
// (String) name]
|
|||
var paths = rawSearchIndex[crate].paths; |
|||
|
|||
// convert `paths` into an object form
|
|||
var len = paths.length; |
|||
for (var i = 0; i < len; ++i) { |
|||
paths[i] = {ty: paths[i][0], name: paths[i][1]}; |
|||
} |
|||
|
|||
// convert `items` into an object form, and construct word indices.
|
|||
//
|
|||
// before any analysis is performed lets gather the search terms to
|
|||
// search against apart from the rest of the data. This is a quick
|
|||
// operation that is cached for the life of the page state so that
|
|||
// all other search operations have access to this cached data for
|
|||
// faster analysis operations
|
|||
var len = items.length; |
|||
var lastPath = ""; |
|||
for (var i = 0; i < len; ++i) { |
|||
var rawRow = items[i]; |
|||
var row = {crate: crate, ty: rawRow[0], name: rawRow[1], |
|||
path: rawRow[2] || lastPath, desc: rawRow[3], |
|||
parent: paths[rawRow[4]], type: rawRow[5]}; |
|||
searchIndex.push(row); |
|||
if (typeof row.name === "string") { |
|||
var word = row.name.toLowerCase(); |
|||
searchWords.push(word); |
|||
} else { |
|||
searchWords.push(""); |
|||
} |
|||
lastPath = row.path; |
|||
} |
|||
} |
|||
return searchWords; |
|||
} |
|||
|
|||
function startSearch() { |
|||
var keyUpTimeout; |
|||
$('.do-search').on('click', search); |
|||
$('.search-input').on('keyup', function() { |
|||
clearTimeout(keyUpTimeout); |
|||
keyUpTimeout = setTimeout(search, 500); |
|||
}); |
|||
|
|||
// Push and pop states are used to add search results to the browser
|
|||
// history.
|
|||
if (browserSupportsHistoryApi()) { |
|||
$(window).on('popstate', function(e) { |
|||
var params = getQueryStringParams(); |
|||
// When browsing back from search results the main page
|
|||
// visibility must be reset.
|
|||
if (!params.search) { |
|||
$('#main.content').removeClass('hidden'); |
|||
$('#search.content').addClass('hidden'); |
|||
} |
|||
// When browsing forward to search results the previous
|
|||
// search will be repeated, so the currentResults are
|
|||
// cleared to ensure the search is successful.
|
|||
currentResults = null; |
|||
// Synchronize search bar with query string state and
|
|||
// perform the search. This will empty the bar if there's
|
|||
// nothing there, which lets you really go back to a
|
|||
// previous state with nothing in the bar.
|
|||
$('.search-input').val(params.search); |
|||
// Some browsers fire 'onpopstate' for every page load
|
|||
// (Chrome), while others fire the event only when actually
|
|||
// popping a state (Firefox), which is why search() is
|
|||
// called both here and at the end of the startSearch()
|
|||
// function.
|
|||
search(); |
|||
}); |
|||
} |
|||
search(); |
|||
} |
|||
|
|||
function plainSummaryLine(markdown) { |
|||
var str = markdown.replace(/\n/g, ' ') |
|||
str = str.replace(/'/g, "\'") |
|||
str = str.replace(/^#+? (.+?)/, "$1") |
|||
str = str.replace(/\[(.*?)\]\(.*?\)/g, "$1") |
|||
str = str.replace(/\[(.*?)\]\[.*?\]/g, "$1") |
|||
return str; |
|||
} |
|||
|
|||
index = buildIndex(rawSearchIndex); |
|||
startSearch(); |
|||
|
|||
// Draw a convenient sidebar of known crates if we have a listing
|
|||
if (rootPath == '../') { |
|||
var sidebar = $('.sidebar'); |
|||
var div = $('<div>').attr('class', 'block crate'); |
|||
div.append($('<h2>').text('Crates')); |
|||
|
|||
var crates = []; |
|||
for (var crate in rawSearchIndex) { |
|||
if (!rawSearchIndex.hasOwnProperty(crate)) { continue } |
|||
crates.push(crate); |
|||
} |
|||
crates.sort(); |
|||
for (var i = 0; i < crates.length; ++i) { |
|||
var klass = 'crate'; |
|||
if (crates[i] == window.currentCrate) { |
|||
klass += ' current'; |
|||
} |
|||
if (rawSearchIndex[crates[i]].items[0]) { |
|||
var desc = rawSearchIndex[crates[i]].items[0][3]; |
|||
div.append($('<a>', {'href': '../' + crates[i] + '/index.html', |
|||
'title': plainSummaryLine(desc), |
|||
'class': klass}).text(crates[i])); |
|||
} |
|||
} |
|||
sidebar.append(div); |
|||
} |
|||
} |
|||
|
|||
window.initSearch = initSearch; |
|||
|
|||
// delayed sidebar rendering.
|
|||
function initSidebarItems(items) { |
|||
var sidebar = $('.sidebar'); |
|||
var current = window.sidebarCurrent; |
|||
|
|||
function block(shortty, longty) { |
|||
var filtered = items[shortty]; |
|||
if (!filtered) return; |
|||
|
|||
var div = $('<div>').attr('class', 'block ' + shortty); |
|||
div.append($('<h2>').text(longty)); |
|||
|
|||
for (var i = 0; i < filtered.length; ++i) { |
|||
var item = filtered[i]; |
|||
var name = item[0]; |
|||
var desc = item[1]; // can be null
|
|||
|
|||
var klass = shortty; |
|||
if (name === current.name && shortty == current.ty) { |
|||
klass += ' current'; |
|||
} |
|||
var path; |
|||
if (shortty === 'mod') { |
|||
path = name + '/index.html'; |
|||
} else { |
|||
path = shortty + '.' + name + '.html'; |
|||
} |
|||
div.append($('<a>', {'href': current.relpath + path, |
|||
'title': desc, |
|||
'class': klass}).text(name)); |
|||
} |
|||
sidebar.append(div); |
|||
} |
|||
|
|||
block("mod", "Modules"); |
|||
block("struct", "Structs"); |
|||
block("enum", "Enums"); |
|||
block("trait", "Traits"); |
|||
block("fn", "Functions"); |
|||
block("macro", "Macros"); |
|||
} |
|||
|
|||
window.initSidebarItems = initSidebarItems; |
|||
|
|||
window.register_implementors = function(imp) { |
|||
var list = $('#implementors-list'); |
|||
var libs = Object.getOwnPropertyNames(imp); |
|||
for (var i = 0; i < libs.length; ++i) { |
|||
if (libs[i] == currentCrate) continue; |
|||
var structs = imp[libs[i]]; |
|||
for (var j = 0; j < structs.length; ++j) { |
|||
var code = $('<code>').append(structs[j]); |
|||
$.each(code.find('a'), function(idx, a) { |
|||
var href = $(a).attr('href'); |
|||
if (href && href.indexOf('http') !== 0) { |
|||
$(a).attr('href', rootPath + href); |
|||
} |
|||
}); |
|||
var li = $('<li>').append(code); |
|||
list.append(li); |
|||
} |
|||
} |
|||
}; |
|||
if (window.pending_implementors) { |
|||
window.register_implementors(window.pending_implementors); |
|||
} |
|||
|
|||
// See documentation in html/render.rs for what this is doing.
|
|||
var query = getQueryStringParams(); |
|||
if (query['gotosrc']) { |
|||
window.location = $('#src-' + query['gotosrc']).attr('href'); |
|||
} |
|||
if (query['gotomacrosrc']) { |
|||
window.location = $('.srclink').attr('href'); |
|||
} |
|||
|
|||
function labelForToggleButton(sectionIsCollapsed) { |
|||
if (sectionIsCollapsed) { |
|||
// button will expand the section
|
|||
return "+"; |
|||
} else { |
|||
// button will collapse the section
|
|||
// note that this text is also set in the HTML template in render.rs
|
|||
return "\u2212"; // "\u2212" is '−' minus sign
|
|||
} |
|||
} |
|||
|
|||
$("#toggle-all-docs").on("click", function() { |
|||
var toggle = $("#toggle-all-docs"); |
|||
if (toggle.hasClass("will-expand")) { |
|||
toggle.removeClass("will-expand"); |
|||
toggle.children(".inner").text(labelForToggleButton(false)); |
|||
toggle.attr("title", "collapse all docs"); |
|||
$(".docblock").show(); |
|||
$(".toggle-label").hide(); |
|||
$(".toggle-wrapper").removeClass("collapsed"); |
|||
$(".collapse-toggle").children(".inner").text(labelForToggleButton(false)); |
|||
} else { |
|||
toggle.addClass("will-expand"); |
|||
toggle.children(".inner").text(labelForToggleButton(true)); |
|||
toggle.attr("title", "expand all docs"); |
|||
$(".docblock").hide(); |
|||
$(".toggle-label").show(); |
|||
$(".toggle-wrapper").addClass("collapsed"); |
|||
$(".collapse-toggle").children(".inner").text(labelForToggleButton(true)); |
|||
} |
|||
}); |
|||
|
|||
$(document).on("click", ".collapse-toggle", function() { |
|||
var toggle = $(this); |
|||
var relatedDoc = toggle.parent().next(); |
|||
if (relatedDoc.is(".stability")) { |
|||
relatedDoc = relatedDoc.next(); |
|||
} |
|||
if (relatedDoc.is(".docblock")) { |
|||
if (relatedDoc.is(":visible")) { |
|||
relatedDoc.slideUp({duration:'fast', easing:'linear'}); |
|||
toggle.parent(".toggle-wrapper").addClass("collapsed"); |
|||
toggle.children(".inner").text(labelForToggleButton(true)); |
|||
toggle.children(".toggle-label").fadeIn(); |
|||
} else { |
|||
relatedDoc.slideDown({duration:'fast', easing:'linear'}); |
|||
toggle.parent(".toggle-wrapper").removeClass("collapsed"); |
|||
toggle.children(".inner").text(labelForToggleButton(false)); |
|||
toggle.children(".toggle-label").hide(); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
$(function() { |
|||
var toggle = $("<a/>", {'href': 'javascript:void(0)', 'class': 'collapse-toggle'}) |
|||
.html("[<span class='inner'></span>]"); |
|||
toggle.children(".inner").text(labelForToggleButton(false)); |
|||
|
|||
$(".method").each(function() { |
|||
if ($(this).next().is(".docblock") || |
|||
($(this).next().is(".stability") && $(this).next().next().is(".docblock"))) { |
|||
$(this).children().first().after(toggle.clone()); |
|||
} |
|||
}); |
|||
|
|||
var mainToggle = |
|||
$(toggle).append( |
|||
$('<span/>', {'class': 'toggle-label'}) |
|||
.css('display', 'none') |
|||
.html(' Expand description')); |
|||
var wrapper = $("<div class='toggle-wrapper'>").append(mainToggle); |
|||
$("#main > .docblock").before(wrapper); |
|||
}); |
|||
|
|||
$('pre.line-numbers').on('click', 'span', function() { |
|||
var prev_id = 0; |
|||
|
|||
function set_fragment(name) { |
|||
if (history.replaceState) { |
|||
history.replaceState(null, null, '#' + name); |
|||
$(window).trigger('hashchange'); |
|||
} else { |
|||
location.replace('#' + name); |
|||
} |
|||
} |
|||
|
|||
return function(ev) { |
|||
var cur_id = parseInt(ev.target.id); |
|||
|
|||
if (ev.shiftKey && prev_id) { |
|||
if (prev_id > cur_id) { |
|||
var tmp = prev_id; |
|||
prev_id = cur_id; |
|||
cur_id = tmp; |
|||
} |
|||
|
|||
set_fragment(prev_id + '-' + cur_id); |
|||
} else { |
|||
prev_id = cur_id; |
|||
|
|||
set_fragment(cur_id); |
|||
} |
|||
}; |
|||
}()); |
|||
|
|||
}()); |
@ -0,0 +1 @@ |
|||
/*! normalize.css v3.0.0 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0} |
@ -0,0 +1,27 @@ |
|||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|||
// file at the top-level directory of this distribution and at
|
|||
// http://rust-lang.org/COPYRIGHT.
|
|||
//
|
|||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|||
// option. This file may not be copied, modified, or distributed
|
|||
// except according to those terms.
|
|||
|
|||
/*jslint browser: true, es5: true */ |
|||
/*globals $: true, rootPath: true */ |
|||
|
|||
(function() { |
|||
if (window.playgroundUrl) { |
|||
$('pre.rust').hover(function() { |
|||
var a = $('<a>').text('⇱').attr('class', 'test-arrow'); |
|||
var code = $(this).prev(".rusttest").text(); |
|||
a.attr('href', window.playgroundUrl + '?code=' + |
|||
encodeURIComponent(code)); |
|||
a.attr('target', '_blank'); |
|||
$(this).append(a); |
|||
}, function() { |
|||
$(this).find('a.test-arrow').remove(); |
|||
}); |
|||
} |
|||
}()); |
4
search-index.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,759 @@ |
|||
<!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="Source to the Rust file `/home/travis/.cargo/registry/src/github.com-1ecc6299db9ec823/complex-0.7.5/src/lib.rs`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang"> |
|||
|
|||
<title>lib.rs.html -- source</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
|
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content source"><pre class="line-numbers"><span id="1"> 1</span> |
|||
<span id="2"> 2</span> |
|||
<span id="3"> 3</span> |
|||
<span id="4"> 4</span> |
|||
<span id="5"> 5</span> |
|||
<span id="6"> 6</span> |
|||
<span id="7"> 7</span> |
|||
<span id="8"> 8</span> |
|||
<span id="9"> 9</span> |
|||
<span id="10"> 10</span> |
|||
<span id="11"> 11</span> |
|||
<span id="12"> 12</span> |
|||
<span id="13"> 13</span> |
|||
<span id="14"> 14</span> |
|||
<span id="15"> 15</span> |
|||
<span id="16"> 16</span> |
|||
<span id="17"> 17</span> |
|||
<span id="18"> 18</span> |
|||
<span id="19"> 19</span> |
|||
<span id="20"> 20</span> |
|||
<span id="21"> 21</span> |
|||
<span id="22"> 22</span> |
|||
<span id="23"> 23</span> |
|||
<span id="24"> 24</span> |
|||
<span id="25"> 25</span> |
|||
<span id="26"> 26</span> |
|||
<span id="27"> 27</span> |
|||
<span id="28"> 28</span> |
|||
<span id="29"> 29</span> |
|||
<span id="30"> 30</span> |
|||
<span id="31"> 31</span> |
|||
<span id="32"> 32</span> |
|||
<span id="33"> 33</span> |
|||
<span id="34"> 34</span> |
|||
<span id="35"> 35</span> |
|||
<span id="36"> 36</span> |
|||
<span id="37"> 37</span> |
|||
<span id="38"> 38</span> |
|||
<span id="39"> 39</span> |
|||
<span id="40"> 40</span> |
|||
<span id="41"> 41</span> |
|||
<span id="42"> 42</span> |
|||
<span id="43"> 43</span> |
|||
<span id="44"> 44</span> |
|||
<span id="45"> 45</span> |
|||
<span id="46"> 46</span> |
|||
<span id="47"> 47</span> |
|||
<span id="48"> 48</span> |
|||
<span id="49"> 49</span> |
|||
<span id="50"> 50</span> |
|||
<span id="51"> 51</span> |
|||
<span id="52"> 52</span> |
|||
<span id="53"> 53</span> |
|||
<span id="54"> 54</span> |
|||
<span id="55"> 55</span> |
|||
<span id="56"> 56</span> |
|||
<span id="57"> 57</span> |
|||
<span id="58"> 58</span> |
|||
<span id="59"> 59</span> |
|||
<span id="60"> 60</span> |
|||
<span id="61"> 61</span> |
|||
<span id="62"> 62</span> |
|||
<span id="63"> 63</span> |
|||
<span id="64"> 64</span> |
|||
<span id="65"> 65</span> |
|||
<span id="66"> 66</span> |
|||
<span id="67"> 67</span> |
|||
<span id="68"> 68</span> |
|||
<span id="69"> 69</span> |
|||
<span id="70"> 70</span> |
|||
<span id="71"> 71</span> |
|||
<span id="72"> 72</span> |
|||
<span id="73"> 73</span> |
|||
<span id="74"> 74</span> |
|||
<span id="75"> 75</span> |
|||
<span id="76"> 76</span> |
|||
<span id="77"> 77</span> |
|||
<span id="78"> 78</span> |
|||
<span id="79"> 79</span> |
|||
<span id="80"> 80</span> |
|||
<span id="81"> 81</span> |
|||
<span id="82"> 82</span> |
|||
<span id="83"> 83</span> |
|||
<span id="84"> 84</span> |
|||
<span id="85"> 85</span> |
|||
<span id="86"> 86</span> |
|||
<span id="87"> 87</span> |
|||
<span id="88"> 88</span> |
|||
<span id="89"> 89</span> |
|||
<span id="90"> 90</span> |
|||
<span id="91"> 91</span> |
|||
<span id="92"> 92</span> |
|||
<span id="93"> 93</span> |
|||
<span id="94"> 94</span> |
|||
<span id="95"> 95</span> |
|||
<span id="96"> 96</span> |
|||
<span id="97"> 97</span> |
|||
<span id="98"> 98</span> |
|||
<span id="99"> 99</span> |
|||
<span id="100">100</span> |
|||
<span id="101">101</span> |
|||
<span id="102">102</span> |
|||
<span id="103">103</span> |
|||
<span id="104">104</span> |
|||
<span id="105">105</span> |
|||
<span id="106">106</span> |
|||
<span id="107">107</span> |
|||
<span id="108">108</span> |
|||
<span id="109">109</span> |
|||
<span id="110">110</span> |
|||
<span id="111">111</span> |
|||
<span id="112">112</span> |
|||
<span id="113">113</span> |
|||
<span id="114">114</span> |
|||
<span id="115">115</span> |
|||
<span id="116">116</span> |
|||
<span id="117">117</span> |
|||
<span id="118">118</span> |
|||
<span id="119">119</span> |
|||
<span id="120">120</span> |
|||
<span id="121">121</span> |
|||
<span id="122">122</span> |
|||
<span id="123">123</span> |
|||
<span id="124">124</span> |
|||
<span id="125">125</span> |
|||
<span id="126">126</span> |
|||
<span id="127">127</span> |
|||
<span id="128">128</span> |
|||
<span id="129">129</span> |
|||
<span id="130">130</span> |
|||
<span id="131">131</span> |
|||
<span id="132">132</span> |
|||
<span id="133">133</span> |
|||
<span id="134">134</span> |
|||
<span id="135">135</span> |
|||
<span id="136">136</span> |
|||
<span id="137">137</span> |
|||
<span id="138">138</span> |
|||
<span id="139">139</span> |
|||
<span id="140">140</span> |
|||
<span id="141">141</span> |
|||
<span id="142">142</span> |
|||
<span id="143">143</span> |
|||
<span id="144">144</span> |
|||
<span id="145">145</span> |
|||
<span id="146">146</span> |
|||
<span id="147">147</span> |
|||
<span id="148">148</span> |
|||
<span id="149">149</span> |
|||
<span id="150">150</span> |
|||
<span id="151">151</span> |
|||
<span id="152">152</span> |
|||
<span id="153">153</span> |
|||
<span id="154">154</span> |
|||
<span id="155">155</span> |
|||
<span id="156">156</span> |
|||
<span id="157">157</span> |
|||
<span id="158">158</span> |
|||
<span id="159">159</span> |
|||
<span id="160">160</span> |
|||
<span id="161">161</span> |
|||
<span id="162">162</span> |
|||
<span id="163">163</span> |
|||
<span id="164">164</span> |
|||
<span id="165">165</span> |
|||
<span id="166">166</span> |
|||
<span id="167">167</span> |
|||
<span id="168">168</span> |
|||
<span id="169">169</span> |
|||
<span id="170">170</span> |
|||
<span id="171">171</span> |
|||
<span id="172">172</span> |
|||
<span id="173">173</span> |
|||
<span id="174">174</span> |
|||
<span id="175">175</span> |
|||
<span id="176">176</span> |
|||
<span id="177">177</span> |
|||
<span id="178">178</span> |
|||
<span id="179">179</span> |
|||
<span id="180">180</span> |
|||
<span id="181">181</span> |
|||
<span id="182">182</span> |
|||
<span id="183">183</span> |
|||
<span id="184">184</span> |
|||
<span id="185">185</span> |
|||
<span id="186">186</span> |
|||
<span id="187">187</span> |
|||
<span id="188">188</span> |
|||
<span id="189">189</span> |
|||
<span id="190">190</span> |
|||
<span id="191">191</span> |
|||
<span id="192">192</span> |
|||
<span id="193">193</span> |
|||
<span id="194">194</span> |
|||
<span id="195">195</span> |
|||
<span id="196">196</span> |
|||
<span id="197">197</span> |
|||
<span id="198">198</span> |
|||
<span id="199">199</span> |
|||
<span id="200">200</span> |
|||
<span id="201">201</span> |
|||
<span id="202">202</span> |
|||
<span id="203">203</span> |
|||
<span id="204">204</span> |
|||
<span id="205">205</span> |
|||
<span id="206">206</span> |
|||
<span id="207">207</span> |
|||
<span id="208">208</span> |
|||
<span id="209">209</span> |
|||
<span id="210">210</span> |
|||
<span id="211">211</span> |
|||
<span id="212">212</span> |
|||
<span id="213">213</span> |
|||
<span id="214">214</span> |
|||
<span id="215">215</span> |
|||
<span id="216">216</span> |
|||
<span id="217">217</span> |
|||
<span id="218">218</span> |
|||
<span id="219">219</span> |
|||
<span id="220">220</span> |
|||
<span id="221">221</span> |
|||
<span id="222">222</span> |
|||
<span id="223">223</span> |
|||
<span id="224">224</span> |
|||
<span id="225">225</span> |
|||
<span id="226">226</span> |
|||
<span id="227">227</span> |
|||
<span id="228">228</span> |
|||
<span id="229">229</span> |
|||
<span id="230">230</span> |
|||
<span id="231">231</span> |
|||
<span id="232">232</span> |
|||
<span id="233">233</span> |
|||
<span id="234">234</span> |
|||
<span id="235">235</span> |
|||
<span id="236">236</span> |
|||
<span id="237">237</span> |
|||
<span id="238">238</span> |
|||
<span id="239">239</span> |
|||
<span id="240">240</span> |
|||
<span id="241">241</span> |
|||
<span id="242">242</span> |
|||
<span id="243">243</span> |
|||
<span id="244">244</span> |
|||
<span id="245">245</span> |
|||
<span id="246">246</span> |
|||
<span id="247">247</span> |
|||
<span id="248">248</span> |
|||
<span id="249">249</span> |
|||
<span id="250">250</span> |
|||
<span id="251">251</span> |
|||
<span id="252">252</span> |
|||
<span id="253">253</span> |
|||
<span id="254">254</span> |
|||
<span id="255">255</span> |
|||
<span id="256">256</span> |
|||
<span id="257">257</span> |
|||
<span id="258">258</span> |
|||
<span id="259">259</span> |
|||
<span id="260">260</span> |
|||
<span id="261">261</span> |
|||
<span id="262">262</span> |
|||
<span id="263">263</span> |
|||
<span id="264">264</span> |
|||
<span id="265">265</span> |
|||
<span id="266">266</span> |
|||
<span id="267">267</span> |
|||
<span id="268">268</span> |
|||
<span id="269">269</span> |
|||
<span id="270">270</span> |
|||
<span id="271">271</span> |
|||
<span id="272">272</span> |
|||
<span id="273">273</span> |
|||
<span id="274">274</span> |
|||
<span id="275">275</span> |
|||
<span id="276">276</span> |
|||
<span id="277">277</span> |
|||
<span id="278">278</span> |
|||
<span id="279">279</span> |
|||
<span id="280">280</span> |
|||
<span id="281">281</span> |
|||
<span id="282">282</span> |
|||
<span id="283">283</span> |
|||
<span id="284">284</span> |
|||
<span id="285">285</span> |
|||
<span id="286">286</span> |
|||
<span id="287">287</span> |
|||
<span id="288">288</span> |
|||
<span id="289">289</span> |
|||
<span id="290">290</span> |
|||
<span id="291">291</span> |
|||
<span id="292">292</span> |
|||
<span id="293">293</span> |
|||
<span id="294">294</span> |
|||
<span id="295">295</span> |
|||
<span id="296">296</span> |
|||
<span id="297">297</span> |
|||
<span id="298">298</span> |
|||
<span id="299">299</span> |
|||
<span id="300">300</span> |
|||
<span id="301">301</span> |
|||
<span id="302">302</span> |
|||
<span id="303">303</span> |
|||
<span id="304">304</span> |
|||
<span id="305">305</span> |
|||
<span id="306">306</span> |
|||
<span id="307">307</span> |
|||
<span id="308">308</span> |
|||
<span id="309">309</span> |
|||
<span id="310">310</span> |
|||
<span id="311">311</span> |
|||
<span id="312">312</span> |
|||
<span id="313">313</span> |
|||
<span id="314">314</span> |
|||
<span id="315">315</span> |
|||
<span id="316">316</span> |
|||
<span id="317">317</span> |
|||
<span id="318">318</span> |
|||
<span id="319">319</span> |
|||
<span id="320">320</span> |
|||
<span id="321">321</span> |
|||
<span id="322">322</span> |
|||
<span id="323">323</span> |
|||
<span id="324">324</span> |
|||
<span id="325">325</span> |
|||
<span id="326">326</span> |
|||
<span id="327">327</span> |
|||
<span id="328">328</span> |
|||
<span id="329">329</span> |
|||
<span id="330">330</span> |
|||
<span id="331">331</span> |
|||
</pre><pre class='rust '> |
|||
<span class='doccomment'>//! [Complex numbers][1].</span> |
|||
<span class='doccomment'>//!</span> |
|||
<span class='doccomment'>//! [1]: https://en.wikipedia.org/wiki/Complex_number</span> |
|||
|
|||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>fmt</span>::<span class='ident'>Debug</span>; |
|||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>ops</span>::{<span class='ident'>Add</span>, <span class='ident'>Div</span>, <span class='ident'>Mul</span>, <span class='ident'>Neg</span>, <span class='ident'>Sub</span>}; |
|||
|
|||
<span class='doccomment'>/// A number.</span> |
|||
<span class='kw'>pub</span> <span class='kw'>trait</span> <span class='ident'>Number</span>: <span class='ident'>Add</span><span class='op'><</span><span class='ident'>Output</span><span class='op'>=</span><span class='kw'>Self</span><span class='op'>></span> <span class='op'>+</span> |
|||
<span class='ident'>Div</span><span class='op'><</span><span class='ident'>Output</span><span class='op'>=</span><span class='kw'>Self</span><span class='op'>></span> <span class='op'>+</span> |
|||
<span class='ident'>Mul</span><span class='op'><</span><span class='ident'>Output</span><span class='op'>=</span><span class='kw'>Self</span><span class='op'>></span> <span class='op'>+</span> |
|||
<span class='ident'>Neg</span><span class='op'><</span><span class='ident'>Output</span><span class='op'>=</span><span class='kw'>Self</span><span class='op'>></span> <span class='op'>+</span> |
|||
<span class='ident'>Sub</span><span class='op'><</span><span class='ident'>Output</span><span class='op'>=</span><span class='kw'>Self</span><span class='op'>></span> <span class='op'>+</span> |
|||
<span class='ident'>Copy</span> <span class='op'>+</span> <span class='ident'>Debug</span> <span class='op'>+</span> <span class='ident'>PartialEq</span> { |
|||
} |
|||
|
|||
<span class='doccomment'>/// A real number.</span> |
|||
<span class='kw'>pub</span> <span class='kw'>trait</span> <span class='ident'>Real</span>: <span class='ident'>Number</span> { |
|||
} |
|||
|
|||
<span class='doccomment'>/// A complex number.</span> |
|||
<span class='kw'>pub</span> <span class='kw'>trait</span> <span class='ident'>Complex</span>: <span class='ident'>Number</span> { |
|||
<span class='doccomment'>/// A real number.</span> |
|||
<span class='kw'>type</span> <span class='ident'>Real</span>: <span class='ident'>Real</span>; |
|||
|
|||
<span class='doccomment'>/// Create a complex number from a real and an imaginary part.</span> |
|||
<span class='kw'>fn</span> <span class='ident'>new</span>(<span class='ident'>Self</span>::<span class='ident'>Real</span>, <span class='ident'>Self</span>::<span class='ident'>Real</span>) <span class='op'>-></span> <span class='kw'>Self</span>; |
|||
|
|||
<span class='doccomment'>/// Create a complex number from a modulus and an argument.</span> |
|||
<span class='kw'>fn</span> <span class='ident'>from_polar</span>(<span class='ident'>Self</span>::<span class='ident'>Real</span>, <span class='ident'>Self</span>::<span class='ident'>Real</span>) <span class='op'>-></span> <span class='kw'>Self</span>; |
|||
|
|||
<span class='doccomment'>/// Return the real part.</span> |
|||
<span class='kw'>fn</span> <span class='ident'>re</span>(<span class='kw-2'>&</span><span class='self'>self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Real</span>; |
|||
|
|||
<span class='doccomment'>/// Return the real part as a mutable reference.</span> |
|||
<span class='kw'>fn</span> <span class='ident'>re_mut</span>(<span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='self'>self</span>) <span class='op'>-></span> <span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>Self</span>::<span class='ident'>Real</span>; |
|||
|
|||
<span class='doccomment'>/// Return the imaginary part.</span> |
|||
<span class='kw'>fn</span> <span class='ident'>im</span>(<span class='kw-2'>&</span><span class='self'>self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Real</span>; |
|||
|
|||
<span class='doccomment'>/// Return the imaginary part as a mutable reference.</span> |
|||
<span class='kw'>fn</span> <span class='ident'>im_mut</span>(<span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='self'>self</span>) <span class='op'>-></span> <span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>Self</span>::<span class='ident'>Real</span>; |
|||
|
|||
<span class='doccomment'>/// Compute the modulus.</span> |
|||
<span class='kw'>fn</span> <span class='ident'>abs</span>(<span class='kw-2'>&</span><span class='self'>self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Real</span>; |
|||
|
|||
<span class='doccomment'>/// Compute the argument.</span> |
|||
<span class='kw'>fn</span> <span class='ident'>arg</span>(<span class='kw-2'>&</span><span class='self'>self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Real</span>; |
|||
|
|||
<span class='doccomment'>/// Compute the modulus and the argument.</span> |
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>to_polar</span>(<span class='kw-2'>&</span><span class='self'>self</span>) <span class='op'>-></span> (<span class='ident'>Self</span>::<span class='ident'>Real</span>, <span class='ident'>Self</span>::<span class='ident'>Real</span>) { |
|||
(<span class='self'>self</span>.<span class='ident'>abs</span>(), <span class='self'>self</span>.<span class='ident'>arg</span>()) |
|||
} |
|||
|
|||
<span class='doccomment'>/// Compute the complex conjugate.</span> |
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>conj</span>(<span class='kw-2'>&</span><span class='self'>self</span>) <span class='op'>-></span> <span class='kw'>Self</span> { |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>(<span class='self'>self</span>.<span class='ident'>re</span>(), <span class='op'>-</span><span class='self'>self</span>.<span class='ident'>im</span>()) |
|||
} |
|||
} |
|||
|
|||
<span class='doccomment'>/// A complex number with 32-bit parts.</span> |
|||
<span class='attribute'>#[<span class='ident'>allow</span>(<span class='ident'>non_camel_case_types</span>)]</span> |
|||
<span class='attribute'>#[<span class='ident'>derive</span>(<span class='ident'>Clone</span>, <span class='ident'>Copy</span>, <span class='ident'>Debug</span>, <span class='ident'>PartialEq</span>)]</span> |
|||
<span class='kw'>pub</span> <span class='kw'>struct</span> <span class='ident'>c32</span>(<span class='kw'>pub</span> <span class='ident'>f32</span>, <span class='kw'>pub</span> <span class='ident'>f32</span>); |
|||
|
|||
<span class='doccomment'>/// A complex number with 64-bit parts.</span> |
|||
<span class='attribute'>#[<span class='ident'>allow</span>(<span class='ident'>non_camel_case_types</span>)]</span> |
|||
<span class='attribute'>#[<span class='ident'>derive</span>(<span class='ident'>Clone</span>, <span class='ident'>Copy</span>, <span class='ident'>Debug</span>, <span class='ident'>PartialEq</span>)]</span> |
|||
<span class='kw'>pub</span> <span class='kw'>struct</span> <span class='ident'>c64</span>(<span class='kw'>pub</span> <span class='ident'>f64</span>, <span class='kw'>pub</span> <span class='ident'>f64</span>); |
|||
|
|||
<span class='macro'>macro_rules</span><span class='macro'>!</span> <span class='ident'>implement</span>( |
|||
(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span>:<span class='ident'>ident</span>, <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span>:<span class='ident'>ty</span>) <span class='op'>=></span> ( |
|||
<span class='kw'>impl</span> <span class='ident'>Number</span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span> { |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Number</span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span> { |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Real</span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span> { |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Complex</span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Real</span> <span class='op'>=</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>new</span>(<span class='ident'>re</span>: <span class='ident'>Self</span>::<span class='ident'>Real</span>, <span class='ident'>im</span>: <span class='ident'>Self</span>::<span class='ident'>Real</span>) <span class='op'>-></span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span> { |
|||
<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span>(<span class='ident'>re</span>, <span class='ident'>im</span>) |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>from_polar</span>(<span class='ident'>abs</span>: <span class='ident'>Self</span>::<span class='ident'>Real</span>, <span class='ident'>arg</span>: <span class='ident'>Self</span>::<span class='ident'>Real</span>) <span class='op'>-></span> <span class='kw'>Self</span> { |
|||
<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span>(<span class='ident'>abs</span> <span class='op'>*</span> <span class='ident'>arg</span>.<span class='ident'>cos</span>(), <span class='ident'>abs</span> <span class='op'>*</span> <span class='ident'>arg</span>.<span class='ident'>sin</span>()) |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>re</span>(<span class='kw-2'>&</span><span class='self'>self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Real</span> { |
|||
<span class='self'>self</span>.<span class='number'>0</span> |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>re_mut</span>(<span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='self'>self</span>) <span class='op'>-></span> <span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>Self</span>::<span class='ident'>Real</span> { |
|||
<span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='self'>self</span>.<span class='number'>0</span> |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>im</span>(<span class='kw-2'>&</span><span class='self'>self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Real</span> { |
|||
<span class='self'>self</span>.<span class='number'>1</span> |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>im_mut</span>(<span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='self'>self</span>) <span class='op'>-></span> <span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='ident'>Self</span>::<span class='ident'>Real</span> { |
|||
<span class='kw-2'>&</span><span class='kw-2'>mut</span> <span class='self'>self</span>.<span class='number'>1</span> |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>abs</span>(<span class='kw-2'>&</span><span class='self'>self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Real</span> { |
|||
<span class='self'>self</span>.<span class='ident'>re</span>().<span class='ident'>hypot</span>(<span class='self'>self</span>.<span class='ident'>im</span>()) |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>arg</span>(<span class='kw-2'>&</span><span class='self'>self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Real</span> { |
|||
<span class='self'>self</span>.<span class='ident'>im</span>().<span class='ident'>atan2</span>(<span class='self'>self</span>.<span class='ident'>re</span>()) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Add</span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='kw'>Self</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>add</span>(<span class='self'>self</span>, <span class='ident'>rhs</span>: <span class='kw'>Self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>(<span class='self'>self</span>.<span class='ident'>re</span>() <span class='op'>+</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>(), <span class='self'>self</span>.<span class='ident'>im</span>() <span class='op'>+</span> <span class='ident'>rhs</span>.<span class='ident'>im</span>()) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Add</span><span class='op'><</span><span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span><span class='op'>></span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='kw'>Self</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>add</span>(<span class='self'>self</span>, <span class='ident'>rhs</span>: <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>(<span class='self'>self</span>.<span class='ident'>re</span>() <span class='op'>+</span> <span class='ident'>rhs</span>, <span class='self'>self</span>.<span class='ident'>im</span>()) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Add</span><span class='op'><</span><span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span><span class='op'>></span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>add</span>(<span class='self'>self</span>, <span class='ident'>rhs</span>: <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>(<span class='self'>self</span> <span class='op'>+</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>(), <span class='ident'>rhs</span>.<span class='ident'>im</span>()) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Div</span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='kw'>Self</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>div</span>(<span class='self'>self</span>, <span class='ident'>rhs</span>: <span class='kw'>Self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='kw'>let</span> <span class='ident'>denominator</span> <span class='op'>=</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>() <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>() <span class='op'>+</span> <span class='ident'>rhs</span>.<span class='ident'>im</span>() <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>im</span>(); |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>((<span class='self'>self</span>.<span class='ident'>re</span>() <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>() <span class='op'>+</span> <span class='self'>self</span>.<span class='ident'>im</span>() <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>im</span>()) <span class='op'>/</span> <span class='ident'>denominator</span>, |
|||
(<span class='self'>self</span>.<span class='ident'>im</span>() <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>() <span class='op'>-</span> <span class='self'>self</span>.<span class='ident'>re</span>() <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>im</span>()) <span class='op'>/</span> <span class='ident'>denominator</span>) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Div</span><span class='op'><</span><span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span><span class='op'>></span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='kw'>Self</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>div</span>(<span class='self'>self</span>, <span class='ident'>rhs</span>: <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>(<span class='self'>self</span>.<span class='ident'>re</span>() <span class='op'>/</span> <span class='ident'>rhs</span>, <span class='self'>self</span>.<span class='ident'>im</span>() <span class='op'>/</span> <span class='ident'>rhs</span>) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Div</span><span class='op'><</span><span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span><span class='op'>></span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>div</span>(<span class='self'>self</span>, <span class='ident'>rhs</span>: <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='kw'>let</span> <span class='ident'>denominator</span> <span class='op'>=</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>() <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>() <span class='op'>+</span> <span class='ident'>rhs</span>.<span class='ident'>im</span>() <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>im</span>(); |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>((<span class='self'>self</span> <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>()) <span class='op'>/</span> <span class='ident'>denominator</span>, (<span class='op'>-</span><span class='self'>self</span> <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>im</span>()) <span class='op'>/</span> <span class='ident'>denominator</span>) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Mul</span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='kw'>Self</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>mul</span>(<span class='self'>self</span>, <span class='ident'>rhs</span>: <span class='kw'>Self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>(<span class='self'>self</span>.<span class='ident'>re</span>() <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>() <span class='op'>-</span> <span class='self'>self</span>.<span class='ident'>im</span>() <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>im</span>(), |
|||
<span class='self'>self</span>.<span class='ident'>im</span>() <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>() <span class='op'>+</span> <span class='self'>self</span>.<span class='ident'>re</span>() <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>im</span>()) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Mul</span><span class='op'><</span><span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span><span class='op'>></span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='kw'>Self</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>mul</span>(<span class='self'>self</span>, <span class='ident'>rhs</span>: <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>(<span class='self'>self</span>.<span class='ident'>re</span>() <span class='op'>*</span> <span class='ident'>rhs</span>, <span class='self'>self</span>.<span class='ident'>im</span>() <span class='op'>*</span> <span class='ident'>rhs</span>) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Mul</span><span class='op'><</span><span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span><span class='op'>></span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>mul</span>(<span class='self'>self</span>, <span class='ident'>rhs</span>: <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>(<span class='self'>self</span> <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>(), <span class='self'>self</span> <span class='op'>*</span> <span class='ident'>rhs</span>.<span class='ident'>im</span>()) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Neg</span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='kw'>Self</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>neg</span>(<span class='self'>self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>(<span class='op'>-</span><span class='self'>self</span>.<span class='ident'>re</span>(), <span class='op'>-</span><span class='self'>self</span>.<span class='ident'>im</span>()) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Sub</span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='kw'>Self</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>sub</span>(<span class='self'>self</span>, <span class='ident'>rhs</span>: <span class='kw'>Self</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>(<span class='self'>self</span>.<span class='ident'>re</span>() <span class='op'>-</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>(), <span class='self'>self</span>.<span class='ident'>im</span>() <span class='op'>-</span> <span class='ident'>rhs</span>.<span class='ident'>im</span>()) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Sub</span><span class='op'><</span><span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span><span class='op'>></span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='kw'>Self</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>sub</span>(<span class='self'>self</span>, <span class='ident'>rhs</span>: <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>(<span class='self'>self</span>.<span class='ident'>re</span>() <span class='op'>-</span> <span class='ident'>rhs</span>, <span class='self'>self</span>.<span class='ident'>im</span>()) |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>impl</span> <span class='ident'>Sub</span><span class='op'><</span><span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span><span class='op'>></span> <span class='kw'>for</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>real</span> { |
|||
<span class='kw'>type</span> <span class='ident'>Output</span> <span class='op'>=</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>inline</span>(<span class='ident'>always</span>)]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>sub</span>(<span class='self'>self</span>, <span class='ident'>rhs</span>: <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>complex</span>) <span class='op'>-></span> <span class='ident'>Self</span>::<span class='ident'>Output</span> { |
|||
<span class='ident'>Complex</span>::<span class='ident'>new</span>(<span class='self'>self</span> <span class='op'>-</span> <span class='ident'>rhs</span>.<span class='ident'>re</span>(), <span class='op'>-</span><span class='ident'>rhs</span>.<span class='ident'>im</span>()) |
|||
} |
|||
} |
|||
); |
|||
); |
|||
|
|||
<span class='macro'>implement</span><span class='macro'>!</span>(<span class='ident'>c32</span>, <span class='ident'>f32</span>); |
|||
<span class='macro'>implement</span><span class='macro'>!</span>(<span class='ident'>c64</span>, <span class='ident'>f64</span>); |
|||
|
|||
<span class='attribute'>#[<span class='ident'>cfg</span>(<span class='ident'>test</span>)]</span> |
|||
<span class='kw'>mod</span> <span class='ident'>tests</span> { |
|||
<span class='kw'>use</span> {<span class='ident'>Complex</span>, <span class='ident'>c64</span>}; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>test</span>]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>re_mut</span>() { |
|||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>number</span> <span class='op'>=</span> <span class='ident'>c64</span>(<span class='number'>69.0</span>, <span class='number'>0.0</span>); |
|||
<span class='op'>*</span><span class='ident'>number</span>.<span class='ident'>re_mut</span>() <span class='op'>=</span> <span class='number'>42.0</span>; |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>number</span>, <span class='ident'>c64</span>(<span class='number'>42.0</span>, <span class='number'>0.0</span>)); |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>test</span>]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>im_mut</span>() { |
|||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>number</span> <span class='op'>=</span> <span class='ident'>c64</span>(<span class='number'>0.0</span>, <span class='number'>69.0</span>); |
|||
<span class='op'>*</span><span class='ident'>number</span>.<span class='ident'>im_mut</span>() <span class='op'>=</span> <span class='number'>42.0</span>; |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>number</span>, <span class='ident'>c64</span>(<span class='number'>0.0</span>, <span class='number'>42.0</span>)); |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>test</span>]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>abs</span>() { |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='number'>4.0</span>, <span class='number'>3.0</span>).<span class='ident'>abs</span>(), <span class='number'>5.0</span>); |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>test</span>]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>arg</span>() { |
|||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>f64</span>::<span class='ident'>consts</span>::<span class='ident'>PI</span>; |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='number'>1.0</span>, <span class='number'>0.0</span>).<span class='ident'>arg</span>(), <span class='number'>0.0</span>); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='number'>1.0</span>, <span class='number'>1.0</span>).<span class='ident'>arg</span>(), <span class='ident'>PI</span> <span class='op'>/</span> <span class='number'>4.0</span>); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='number'>0.0</span>, <span class='number'>1.0</span>).<span class='ident'>arg</span>(), <span class='ident'>PI</span> <span class='op'>/</span> <span class='number'>2.0</span>); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='op'>-</span><span class='number'>1.0</span>, <span class='number'>0.0</span>).<span class='ident'>arg</span>(), <span class='ident'>PI</span>); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='number'>0.0</span>, <span class='op'>-</span><span class='number'>1.0</span>).<span class='ident'>arg</span>(), <span class='op'>-</span><span class='ident'>PI</span> <span class='op'>/</span> <span class='number'>2.0</span>); |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>test</span>]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>conj</span>() { |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='number'>42.0</span>, <span class='number'>69.0</span>).<span class='ident'>conj</span>(), <span class='ident'>c64</span>(<span class='number'>42.0</span>, <span class='op'>-</span><span class='number'>69.0</span>)); |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>test</span>]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>add</span>() { |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='op'>-</span><span class='number'>4.0</span>, <span class='number'>7.0</span>) <span class='op'>+</span> <span class='ident'>c64</span>(<span class='number'>5.0</span>, <span class='op'>-</span><span class='number'>10.0</span>), <span class='ident'>c64</span>(<span class='number'>1.0</span>, <span class='op'>-</span><span class='number'>3.0</span>)); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='op'>-</span><span class='number'>4.0</span>, <span class='number'>7.0</span>) <span class='op'>+</span> <span class='number'>5.0</span>, <span class='ident'>c64</span>(<span class='number'>1.0</span>, <span class='number'>7.0</span>)); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='number'>5.0</span> <span class='op'>+</span> <span class='ident'>c64</span>(<span class='op'>-</span><span class='number'>4.0</span>, <span class='number'>7.0</span>), <span class='ident'>c64</span>(<span class='number'>1.0</span>, <span class='number'>7.0</span>)); |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>test</span>]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>div</span>() { |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='number'>3.0</span>, <span class='op'>-</span><span class='number'>1.0</span>) <span class='op'>/</span> <span class='ident'>c64</span>(<span class='number'>2.0</span>, <span class='number'>7.0</span>), <span class='ident'>c64</span>(<span class='op'>-</span><span class='number'>1.0</span> <span class='op'>/</span> <span class='number'>53.0</span>, <span class='op'>-</span><span class='number'>23.0</span> <span class='op'>/</span> <span class='number'>53.0</span>)); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='number'>3.0</span>, <span class='op'>-</span><span class='number'>1.0</span>) <span class='op'>/</span> <span class='number'>2.0</span>, <span class='ident'>c64</span>(<span class='number'>1.5</span>, <span class='op'>-</span><span class='number'>0.5</span>)); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='number'>2.0</span> <span class='op'>/</span> <span class='ident'>c64</span>(<span class='number'>3.0</span>, <span class='op'>-</span><span class='number'>1.0</span>), <span class='ident'>c64</span>(<span class='number'>0.6</span>, <span class='number'>0.2</span>)); |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>test</span>]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>mul</span>() { |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='number'>4.0</span>, <span class='number'>1.0</span>) <span class='op'>*</span> <span class='ident'>c64</span>(<span class='number'>2.0</span>, <span class='number'>3.0</span>), <span class='ident'>c64</span>(<span class='number'>5.0</span>, <span class='number'>14.0</span>)); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='number'>4.0</span>, <span class='number'>1.0</span>) <span class='op'>*</span> <span class='number'>2.0</span>, <span class='ident'>c64</span>(<span class='number'>8.0</span>, <span class='number'>2.0</span>)); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='number'>2.0</span> <span class='op'>*</span> <span class='ident'>c64</span>(<span class='number'>4.0</span>, <span class='number'>1.0</span>), <span class='ident'>c64</span>(<span class='number'>8.0</span>, <span class='number'>2.0</span>)); |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>test</span>]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>neg</span>() { |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='op'>-</span><span class='ident'>c64</span>(<span class='number'>42.0</span>, <span class='number'>69.0</span>), <span class='ident'>c64</span>(<span class='number'>42.0</span>, <span class='number'>69.0</span>) <span class='op'>*</span> (<span class='op'>-</span><span class='number'>1.0</span>)); |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>test</span>]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>sub</span>() { |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='number'>4.0</span>, <span class='number'>12.0</span>) <span class='op'>-</span> <span class='ident'>c64</span>(<span class='number'>3.0</span>, <span class='op'>-</span><span class='number'>15.0</span>), <span class='ident'>c64</span>(<span class='number'>1.0</span>, <span class='number'>27.0</span>)); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>c64</span>(<span class='number'>4.0</span>, <span class='number'>12.0</span>) <span class='op'>-</span> <span class='number'>3.0</span>, <span class='ident'>c64</span>(<span class='number'>1.0</span>, <span class='number'>12.0</span>)); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='number'>3.0</span> <span class='op'>-</span> <span class='ident'>c64</span>(<span class='number'>4.0</span>, <span class='number'>12.0</span>), <span class='ident'>c64</span>(<span class='op'>-</span><span class='number'>1.0</span>, <span class='op'>-</span><span class='number'>12.0</span>)); |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>test</span>]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>size_of</span>() { |
|||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>mem</span>::<span class='ident'>size_of</span>; |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>size_of</span>::<span class='op'><</span><span class='ident'>c64</span><span class='op'>></span>(), <span class='number'>2</span> <span class='op'>*</span> <span class='ident'>size_of</span>::<span class='op'><</span><span class='ident'>f64</span><span class='op'>></span>()); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>size_of</span>::<span class='op'><</span>[<span class='ident'>c64</span>; <span class='number'>42</span>]<span class='op'>></span>(), <span class='ident'>size_of</span>::<span class='op'><</span>[<span class='ident'>f64</span>; <span class='number'>2</span> <span class='op'>*</span> <span class='number'>42</span>]<span class='op'>></span>()); |
|||
} |
|||
} |
|||
</pre> |
|||
</section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "complex"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,259 @@ |
|||
<!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="Source to the Rust file `src/complex.rs`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang"> |
|||
|
|||
<title>complex.rs.html -- source</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
|
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content source"><pre class="line-numbers"><span id="1"> 1</span> |
|||
<span id="2"> 2</span> |
|||
<span id="3"> 3</span> |
|||
<span id="4"> 4</span> |
|||
<span id="5"> 5</span> |
|||
<span id="6"> 6</span> |
|||
<span id="7"> 7</span> |
|||
<span id="8"> 8</span> |
|||
<span id="9"> 9</span> |
|||
<span id="10">10</span> |
|||
<span id="11">11</span> |
|||
<span id="12">12</span> |
|||
<span id="13">13</span> |
|||
<span id="14">14</span> |
|||
<span id="15">15</span> |
|||
<span id="16">16</span> |
|||
<span id="17">17</span> |
|||
<span id="18">18</span> |
|||
<span id="19">19</span> |
|||
<span id="20">20</span> |
|||
<span id="21">21</span> |
|||
<span id="22">22</span> |
|||
<span id="23">23</span> |
|||
<span id="24">24</span> |
|||
<span id="25">25</span> |
|||
<span id="26">26</span> |
|||
<span id="27">27</span> |
|||
<span id="28">28</span> |
|||
<span id="29">29</span> |
|||
<span id="30">30</span> |
|||
<span id="31">31</span> |
|||
<span id="32">32</span> |
|||
<span id="33">33</span> |
|||
<span id="34">34</span> |
|||
<span id="35">35</span> |
|||
<span id="36">36</span> |
|||
<span id="37">37</span> |
|||
<span id="38">38</span> |
|||
<span id="39">39</span> |
|||
<span id="40">40</span> |
|||
<span id="41">41</span> |
|||
<span id="42">42</span> |
|||
<span id="43">43</span> |
|||
<span id="44">44</span> |
|||
<span id="45">45</span> |
|||
<span id="46">46</span> |
|||
<span id="47">47</span> |
|||
<span id="48">48</span> |
|||
<span id="49">49</span> |
|||
<span id="50">50</span> |
|||
<span id="51">51</span> |
|||
<span id="52">52</span> |
|||
<span id="53">53</span> |
|||
<span id="54">54</span> |
|||
<span id="55">55</span> |
|||
<span id="56">56</span> |
|||
<span id="57">57</span> |
|||
<span id="58">58</span> |
|||
<span id="59">59</span> |
|||
<span id="60">60</span> |
|||
<span id="61">61</span> |
|||
<span id="62">62</span> |
|||
<span id="63">63</span> |
|||
<span id="64">64</span> |
|||
<span id="65">65</span> |
|||
<span id="66">66</span> |
|||
<span id="67">67</span> |
|||
<span id="68">68</span> |
|||
<span id="69">69</span> |
|||
<span id="70">70</span> |
|||
<span id="71">71</span> |
|||
<span id="72">72</span> |
|||
<span id="73">73</span> |
|||
<span id="74">74</span> |
|||
<span id="75">75</span> |
|||
<span id="76">76</span> |
|||
<span id="77">77</span> |
|||
<span id="78">78</span> |
|||
<span id="79">79</span> |
|||
<span id="80">80</span> |
|||
<span id="81">81</span> |
|||
</pre><pre class='rust '> |
|||
<span class='doccomment'>//! Transformation of complex data.</span> |
|||
|
|||
<span class='comment'>// The implementation is based on:</span> |
|||
<span class='comment'>// http://www.librow.com/articles/article-10</span> |
|||
|
|||
<span class='kw'>use</span> <span class='ident'>number</span>::<span class='ident'>c64</span>; |
|||
|
|||
<span class='doccomment'>/// Perform the forward transform.</span> |
|||
<span class='doccomment'>///</span> |
|||
<span class='doccomment'>/// The number of points should be a power of two.</span> |
|||
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>forward</span>(<span class='ident'>data</span>: <span class='kw-2'>&</span><span class='kw-2'>mut</span> [<span class='ident'>c64</span>]) { |
|||
<span class='kw'>let</span> <span class='ident'>n</span> <span class='op'>=</span> <span class='macro'>power_of_two</span><span class='macro'>!</span>(<span class='ident'>data</span>); |
|||
<span class='ident'>rearrange</span>(<span class='ident'>data</span>, <span class='ident'>n</span>); |
|||
<span class='ident'>transform</span>(<span class='ident'>data</span>, <span class='ident'>n</span>, <span class='boolval'>false</span>); |
|||
} |
|||
|
|||
<span class='doccomment'>/// Perform the backward transform.</span> |
|||
<span class='doccomment'>///</span> |
|||
<span class='doccomment'>/// The number of points should be a power of two.</span> |
|||
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>backward</span>(<span class='ident'>data</span>: <span class='kw-2'>&</span><span class='kw-2'>mut</span> [<span class='ident'>c64</span>]) { |
|||
<span class='kw'>let</span> <span class='ident'>n</span> <span class='op'>=</span> <span class='macro'>power_of_two</span><span class='macro'>!</span>(<span class='ident'>data</span>); |
|||
<span class='ident'>rearrange</span>(<span class='ident'>data</span>, <span class='ident'>n</span>); |
|||
<span class='ident'>transform</span>(<span class='ident'>data</span>, <span class='ident'>n</span>, <span class='boolval'>true</span>); |
|||
} |
|||
|
|||
<span class='doccomment'>/// Perform the inverse transform.</span> |
|||
<span class='doccomment'>///</span> |
|||
<span class='doccomment'>/// The number of points should be a power of two.</span> |
|||
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>inverse</span>(<span class='ident'>data</span>: <span class='kw-2'>&</span><span class='kw-2'>mut</span> [<span class='ident'>c64</span>]) { |
|||
<span class='kw'>let</span> <span class='ident'>n</span> <span class='op'>=</span> <span class='macro'>power_of_two</span><span class='macro'>!</span>(<span class='ident'>data</span>); |
|||
<span class='ident'>rearrange</span>(<span class='ident'>data</span>, <span class='ident'>n</span>); |
|||
<span class='ident'>transform</span>(<span class='ident'>data</span>, <span class='ident'>n</span>, <span class='boolval'>true</span>); |
|||
<span class='ident'>scale</span>(<span class='ident'>data</span>, <span class='ident'>n</span>); |
|||
} |
|||
|
|||
<span class='kw'>fn</span> <span class='ident'>rearrange</span>(<span class='ident'>data</span>: <span class='kw-2'>&</span><span class='kw-2'>mut</span> [<span class='ident'>c64</span>], <span class='ident'>n</span>: <span class='ident'>usize</span>) { |
|||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>j</span> <span class='op'>=</span> <span class='number'>0</span>; |
|||
<span class='kw'>for</span> <span class='ident'>i</span> <span class='kw'>in</span> <span class='number'>0</span>..<span class='ident'>n</span> { |
|||
<span class='kw'>if</span> <span class='ident'>j</span> <span class='op'>></span> <span class='ident'>i</span> { |
|||
<span class='ident'>data</span>.<span class='ident'>swap</span>(<span class='ident'>i</span>, <span class='ident'>j</span>); |
|||
} |
|||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>mask</span> <span class='op'>=</span> <span class='ident'>n</span> <span class='op'>>></span> <span class='number'>1</span>; |
|||
<span class='kw'>while</span> <span class='ident'>j</span> <span class='kw-2'>&</span> <span class='ident'>mask</span> <span class='op'>!=</span> <span class='number'>0</span> { |
|||
<span class='ident'>j</span> <span class='op'>&=</span> <span class='op'>!</span><span class='ident'>mask</span>; |
|||
<span class='ident'>mask</span> <span class='op'>>>=</span> <span class='number'>1</span>; |
|||
} |
|||
<span class='ident'>j</span> <span class='op'>|=</span> <span class='ident'>mask</span>; |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>fn</span> <span class='ident'>transform</span>(<span class='ident'>data</span>: <span class='kw-2'>&</span><span class='kw-2'>mut</span> [<span class='ident'>c64</span>], <span class='ident'>n</span>: <span class='ident'>usize</span>, <span class='ident'>inverse</span>: <span class='ident'>bool</span>) { |
|||
<span class='kw'>let</span> <span class='ident'>sign</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='ident'>inverse</span> { <span class='number'>1.0</span> } <span class='kw'>else</span> { <span class='op'>-</span><span class='number'>1.0</span> }; |
|||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>step</span> <span class='op'>=</span> <span class='number'>1</span>; |
|||
<span class='kw'>while</span> <span class='ident'>step</span> <span class='op'><</span> <span class='ident'>n</span> { |
|||
<span class='kw'>let</span> <span class='ident'>jump</span> <span class='op'>=</span> <span class='ident'>step</span> <span class='op'><<</span> <span class='number'>1</span>; |
|||
<span class='kw'>let</span> (<span class='ident'>multiplier</span>, <span class='kw-2'>mut</span> <span class='ident'>factor</span>) <span class='op'>=</span> { |
|||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>f64</span>::<span class='ident'>consts</span>::<span class='ident'>PI</span>; |
|||
<span class='kw'>let</span> <span class='ident'>theta</span> <span class='op'>=</span> <span class='ident'>sign</span> <span class='op'>*</span> <span class='ident'>PI</span> <span class='op'>/</span> <span class='ident'>step</span> <span class='kw'>as</span> <span class='ident'>f64</span>; |
|||
<span class='kw'>let</span> <span class='ident'>sine</span> <span class='op'>=</span> (<span class='number'>0.5</span> <span class='op'>*</span> <span class='ident'>theta</span>).<span class='ident'>sin</span>(); |
|||
(<span class='ident'>c64</span>(<span class='op'>-</span><span class='number'>2.0</span> <span class='op'>*</span> <span class='ident'>sine</span> <span class='op'>*</span> <span class='ident'>sine</span>, <span class='ident'>theta</span>.<span class='ident'>sin</span>()), <span class='ident'>c64</span>(<span class='number'>1.0</span>, <span class='number'>0.0</span>)) |
|||
}; |
|||
<span class='kw'>for</span> <span class='kw-2'>mut</span> <span class='ident'>i</span> <span class='kw'>in</span> <span class='number'>0</span>..<span class='ident'>step</span> { |
|||
<span class='kw'>while</span> <span class='ident'>i</span> <span class='op'><</span> <span class='ident'>n</span> { |
|||
<span class='kw'>let</span> <span class='ident'>j</span> <span class='op'>=</span> <span class='ident'>i</span> <span class='op'>+</span> <span class='ident'>step</span>; |
|||
<span class='kw'>let</span> <span class='ident'>product</span> <span class='op'>=</span> <span class='ident'>factor</span> <span class='op'>*</span> <span class='ident'>data</span>[<span class='ident'>j</span>]; |
|||
<span class='ident'>data</span>[<span class='ident'>j</span>] <span class='op'>=</span> <span class='ident'>data</span>[<span class='ident'>i</span>] <span class='op'>-</span> <span class='ident'>product</span>; |
|||
<span class='ident'>data</span>[<span class='ident'>i</span>] <span class='op'>=</span> <span class='ident'>data</span>[<span class='ident'>i</span>] <span class='op'>+</span> <span class='ident'>product</span>; |
|||
<span class='ident'>i</span> <span class='op'>+=</span> <span class='ident'>jump</span>; |
|||
} |
|||
<span class='ident'>factor</span> <span class='op'>=</span> <span class='ident'>multiplier</span> <span class='op'>*</span> <span class='ident'>factor</span> <span class='op'>+</span> <span class='ident'>factor</span>; |
|||
} |
|||
<span class='ident'>step</span> <span class='op'><<=</span> <span class='number'>1</span>; |
|||
} |
|||
} |
|||
|
|||
<span class='kw'>fn</span> <span class='ident'>scale</span>(<span class='ident'>data</span>: <span class='kw-2'>&</span><span class='kw-2'>mut</span> [<span class='ident'>c64</span>], <span class='ident'>n</span>: <span class='ident'>usize</span>) { |
|||
<span class='kw'>let</span> <span class='ident'>factor</span> <span class='op'>=</span> <span class='number'>1.0</span> <span class='op'>/</span> <span class='ident'>n</span> <span class='kw'>as</span> <span class='ident'>f64</span>; |
|||
<span class='kw'>for</span> <span class='ident'>i</span> <span class='kw'>in</span> <span class='number'>0</span>..<span class='ident'>n</span> { |
|||
<span class='ident'>data</span>[<span class='ident'>i</span>] <span class='op'>=</span> <span class='ident'>data</span>[<span class='ident'>i</span>] <span class='op'>*</span> <span class='ident'>factor</span>; |
|||
} |
|||
} |
|||
</pre> |
|||
</section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,133 @@ |
|||
<!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="Source to the Rust file `src/lib.rs`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang"> |
|||
|
|||
<title>lib.rs.html -- source</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
|
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content source"><pre class="line-numbers"><span id="1"> 1</span> |
|||
<span id="2"> 2</span> |
|||
<span id="3"> 3</span> |
|||
<span id="4"> 4</span> |
|||
<span id="5"> 5</span> |
|||
<span id="6"> 6</span> |
|||
<span id="7"> 7</span> |
|||
<span id="8"> 8</span> |
|||
<span id="9"> 9</span> |
|||
<span id="10">10</span> |
|||
<span id="11">11</span> |
|||
<span id="12">12</span> |
|||
<span id="13">13</span> |
|||
<span id="14">14</span> |
|||
<span id="15">15</span> |
|||
<span id="16">16</span> |
|||
<span id="17">17</span> |
|||
<span id="18">18</span> |
|||
</pre><pre class='rust '> |
|||
<span class='doccomment'>//! [Discrete Fourier transform][1].</span> |
|||
<span class='doccomment'>//!</span> |
|||
<span class='doccomment'>//! [1]: https://en.wikipedia.org/wiki/Discrete_Fourier_transform</span> |
|||
|
|||
<span class='kw'>extern</span> <span class='kw'>crate</span> <span class='ident'>complex</span> <span class='kw'>as</span> <span class='ident'>number</span>; |
|||
|
|||
<span class='macro'>macro_rules</span><span class='macro'>!</span> <span class='ident'>power_of_two</span>( |
|||
(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>data</span>:<span class='ident'>expr</span>) <span class='op'>=></span> ({ |
|||
<span class='kw'>let</span> <span class='ident'>n</span> <span class='op'>=</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>data</span>.<span class='ident'>len</span>(); |
|||
<span class='kw'>if</span> <span class='op'>!</span><span class='ident'>n</span>.<span class='ident'>is_power_of_two</span>() { |
|||
<span class='macro'>panic</span><span class='macro'>!</span>(<span class='string'>"expected the number of points to be a power of two"</span>); |
|||
} |
|||
<span class='ident'>n</span> |
|||
}); |
|||
); |
|||
|
|||
<span class='kw'>pub</span> <span class='kw'>mod</span> <span class='ident'>complex</span>; |
|||
<span class='kw'>pub</span> <span class='kw'>mod</span> <span class='ident'>real</span>; |
|||
</pre> |
|||
</section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,323 @@ |
|||
<!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="Source to the Rust file `src/real.rs`."> |
|||
<meta name="keywords" content="rust, rustlang, rust-lang"> |
|||
|
|||
<title>real.rs.html -- source</title> |
|||
|
|||
<link rel="stylesheet" type="text/css" href="../../main.css"> |
|||
|
|||
|
|||
|
|||
</head> |
|||
<body class="rustdoc"> |
|||
<!--[if lte IE 8]> |
|||
<div class="warning"> |
|||
This old browser is unsupported and will most likely display funky |
|||
things. |
|||
</div> |
|||
<![endif]--> |
|||
|
|||
|
|||
|
|||
<section class="sidebar"> |
|||
|
|||
|
|||
</section> |
|||
|
|||
<nav class="sub"> |
|||
<form class="search-form js-only"> |
|||
<div class="search-container"> |
|||
<input class="search-input" name="search" |
|||
autocomplete="off" |
|||
placeholder="Click or press 'S' to search, '?' for more options..." |
|||
type="search"> |
|||
</div> |
|||
</form> |
|||
</nav> |
|||
|
|||
<section id='main' class="content source"><pre class="line-numbers"><span id="1"> 1</span> |
|||
<span id="2"> 2</span> |
|||
<span id="3"> 3</span> |
|||
<span id="4"> 4</span> |
|||
<span id="5"> 5</span> |
|||
<span id="6"> 6</span> |
|||
<span id="7"> 7</span> |
|||
<span id="8"> 8</span> |
|||
<span id="9"> 9</span> |
|||
<span id="10"> 10</span> |
|||
<span id="11"> 11</span> |
|||
<span id="12"> 12</span> |
|||
<span id="13"> 13</span> |
|||
<span id="14"> 14</span> |
|||
<span id="15"> 15</span> |
|||
<span id="16"> 16</span> |
|||
<span id="17"> 17</span> |
|||
<span id="18"> 18</span> |
|||
<span id="19"> 19</span> |
|||
<span id="20"> 20</span> |
|||
<span id="21"> 21</span> |
|||
<span id="22"> 22</span> |
|||
<span id="23"> 23</span> |
|||
<span id="24"> 24</span> |
|||
<span id="25"> 25</span> |
|||
<span id="26"> 26</span> |
|||
<span id="27"> 27</span> |
|||
<span id="28"> 28</span> |
|||
<span id="29"> 29</span> |
|||
<span id="30"> 30</span> |
|||
<span id="31"> 31</span> |
|||
<span id="32"> 32</span> |
|||
<span id="33"> 33</span> |
|||
<span id="34"> 34</span> |
|||
<span id="35"> 35</span> |
|||
<span id="36"> 36</span> |
|||
<span id="37"> 37</span> |
|||
<span id="38"> 38</span> |
|||
<span id="39"> 39</span> |
|||
<span id="40"> 40</span> |
|||
<span id="41"> 41</span> |
|||
<span id="42"> 42</span> |
|||
<span id="43"> 43</span> |
|||
<span id="44"> 44</span> |
|||
<span id="45"> 45</span> |
|||
<span id="46"> 46</span> |
|||
<span id="47"> 47</span> |
|||
<span id="48"> 48</span> |
|||
<span id="49"> 49</span> |
|||
<span id="50"> 50</span> |
|||
<span id="51"> 51</span> |
|||
<span id="52"> 52</span> |
|||
<span id="53"> 53</span> |
|||
<span id="54"> 54</span> |
|||
<span id="55"> 55</span> |
|||
<span id="56"> 56</span> |
|||
<span id="57"> 57</span> |
|||
<span id="58"> 58</span> |
|||
<span id="59"> 59</span> |
|||
<span id="60"> 60</span> |
|||
<span id="61"> 61</span> |
|||
<span id="62"> 62</span> |
|||
<span id="63"> 63</span> |
|||
<span id="64"> 64</span> |
|||
<span id="65"> 65</span> |
|||
<span id="66"> 66</span> |
|||
<span id="67"> 67</span> |
|||
<span id="68"> 68</span> |
|||
<span id="69"> 69</span> |
|||
<span id="70"> 70</span> |
|||
<span id="71"> 71</span> |
|||
<span id="72"> 72</span> |
|||
<span id="73"> 73</span> |
|||
<span id="74"> 74</span> |
|||
<span id="75"> 75</span> |
|||
<span id="76"> 76</span> |
|||
<span id="77"> 77</span> |
|||
<span id="78"> 78</span> |
|||
<span id="79"> 79</span> |
|||
<span id="80"> 80</span> |
|||
<span id="81"> 81</span> |
|||
<span id="82"> 82</span> |
|||
<span id="83"> 83</span> |
|||
<span id="84"> 84</span> |
|||
<span id="85"> 85</span> |
|||
<span id="86"> 86</span> |
|||
<span id="87"> 87</span> |
|||
<span id="88"> 88</span> |
|||
<span id="89"> 89</span> |
|||
<span id="90"> 90</span> |
|||
<span id="91"> 91</span> |
|||
<span id="92"> 92</span> |
|||
<span id="93"> 93</span> |
|||
<span id="94"> 94</span> |
|||
<span id="95"> 95</span> |
|||
<span id="96"> 96</span> |
|||
<span id="97"> 97</span> |
|||
<span id="98"> 98</span> |
|||
<span id="99"> 99</span> |
|||
<span id="100">100</span> |
|||
<span id="101">101</span> |
|||
<span id="102">102</span> |
|||
<span id="103">103</span> |
|||
<span id="104">104</span> |
|||
<span id="105">105</span> |
|||
<span id="106">106</span> |
|||
<span id="107">107</span> |
|||
<span id="108">108</span> |
|||
<span id="109">109</span> |
|||
<span id="110">110</span> |
|||
<span id="111">111</span> |
|||
<span id="112">112</span> |
|||
<span id="113">113</span> |
|||
</pre><pre class='rust '> |
|||
<span class='doccomment'>//! Transformation of real data.</span> |
|||
|
|||
<span class='kw'>use</span> <span class='ident'>number</span>::{<span class='ident'>Complex</span>, <span class='ident'>c64</span>}; |
|||
|
|||
<span class='macro'>macro_rules</span><span class='macro'>!</span> <span class='ident'>reinterpret</span>( |
|||
(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>data</span>:<span class='ident'>ident</span>) <span class='op'>=></span> (<span class='kw'>unsafe</span> { |
|||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>slice</span>::<span class='ident'>from_raw_parts_mut</span>; |
|||
<span class='kw'>let</span> <span class='ident'>n</span> <span class='op'>=</span> <span class='macro'>power_of_two</span><span class='macro'>!</span>(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>data</span>); |
|||
(<span class='ident'>from_raw_parts_mut</span>(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>data</span>.<span class='ident'>as_mut_ptr</span>() <span class='kw'>as</span> <span class='op'>*</span><span class='kw-2'>mut</span> _, <span class='ident'>n</span> <span class='op'>/</span> <span class='number'>2</span>), <span class='ident'>n</span> <span class='op'>/</span> <span class='number'>2</span>) |
|||
}); |
|||
); |
|||
|
|||
<span class='doccomment'>/// Perform the forward transform.</span> |
|||
<span class='doccomment'>///</span> |
|||
<span class='doccomment'>/// The number of points should be a power of two. The data are replaced by the</span> |
|||
<span class='doccomment'>/// positive frequency half of their complex Fourier transform. The real-valued</span> |
|||
<span class='doccomment'>/// first and last components of the complex transform are returned as elements</span> |
|||
<span class='doccomment'>/// `data[0]` and `data[1]`, respectively.</span> |
|||
<span class='doccomment'>///</span> |
|||
<span class='doccomment'>/// ## References</span> |
|||
<span class='doccomment'>///</span> |
|||
<span class='doccomment'>/// 1. William H. Press, Saul A. Teukolsky, William T. Vetterling, Brian P.</span> |
|||
<span class='doccomment'>/// Flannery, “Numerical Recipes 3rd Edition: The Art of Scientific</span> |
|||
<span class='doccomment'>/// Computing,” Cambridge University Press, 2007.</span> |
|||
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>forward</span>(<span class='ident'>data</span>: <span class='kw-2'>&</span><span class='kw-2'>mut</span> [<span class='ident'>f64</span>]) { |
|||
<span class='kw'>let</span> (<span class='ident'>data</span>, <span class='ident'>n</span>) <span class='op'>=</span> <span class='macro'>reinterpret</span><span class='macro'>!</span>(<span class='ident'>data</span>); |
|||
::<span class='ident'>complex</span>::<span class='ident'>forward</span>(<span class='ident'>data</span>); |
|||
<span class='ident'>compose</span>(<span class='ident'>data</span>, <span class='ident'>n</span>, <span class='boolval'>false</span>); |
|||
} |
|||
|
|||
<span class='doccomment'>/// Perform the backward transform.</span> |
|||
<span class='doccomment'>///</span> |
|||
<span class='doccomment'>/// The number of points should be a power of two. The data should be packed as</span> |
|||
<span class='doccomment'>/// described in `real::forward`.</span> |
|||
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>backward</span>(<span class='ident'>data</span>: <span class='kw-2'>&</span><span class='kw-2'>mut</span> [<span class='ident'>f64</span>]) { |
|||
<span class='kw'>let</span> (<span class='ident'>data</span>, <span class='ident'>n</span>) <span class='op'>=</span> <span class='macro'>reinterpret</span><span class='macro'>!</span>(<span class='ident'>data</span>); |
|||
<span class='ident'>compose</span>(<span class='ident'>data</span>, <span class='ident'>n</span>, <span class='boolval'>true</span>); |
|||
::<span class='ident'>complex</span>::<span class='ident'>backward</span>(<span class='ident'>data</span>); |
|||
} |
|||
|
|||
<span class='doccomment'>/// Perform the inverse transform.</span> |
|||
<span class='doccomment'>///</span> |
|||
<span class='doccomment'>/// The number of points should be a power of two. The data should be packed as</span> |
|||
<span class='doccomment'>/// described in `real::forward`.</span> |
|||
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>inverse</span>(<span class='ident'>data</span>: <span class='kw-2'>&</span><span class='kw-2'>mut</span> [<span class='ident'>f64</span>]) { |
|||
<span class='kw'>let</span> (<span class='ident'>data</span>, <span class='ident'>n</span>) <span class='op'>=</span> <span class='macro'>reinterpret</span><span class='macro'>!</span>(<span class='ident'>data</span>); |
|||
<span class='ident'>compose</span>(<span class='ident'>data</span>, <span class='ident'>n</span>, <span class='boolval'>true</span>); |
|||
::<span class='ident'>complex</span>::<span class='ident'>inverse</span>(<span class='ident'>data</span>); |
|||
} |
|||
|
|||
<span class='doccomment'>/// Unpack a compressed representation produced by `real::forward`.</span> |
|||
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>unpack</span>(<span class='ident'>data</span>: <span class='kw-2'>&</span>[<span class='ident'>f64</span>]) <span class='op'>-></span> <span class='ident'>Vec</span><span class='op'><</span><span class='ident'>c64</span><span class='op'>></span> { |
|||
<span class='kw'>let</span> <span class='ident'>n</span> <span class='op'>=</span> <span class='macro'>power_of_two</span><span class='macro'>!</span>(<span class='ident'>data</span>); |
|||
|
|||
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>cdata</span> <span class='op'>=</span> <span class='ident'>Vec</span>::<span class='ident'>with_capacity</span>(<span class='ident'>n</span>); |
|||
<span class='kw'>unsafe</span> { <span class='ident'>cdata</span>.<span class='ident'>set_len</span>(<span class='ident'>n</span>) }; |
|||
|
|||
<span class='ident'>cdata</span>[<span class='number'>0</span>] <span class='op'>=</span> <span class='ident'>c64</span>(<span class='ident'>data</span>[<span class='number'>0</span>], <span class='number'>0.0</span>); |
|||
<span class='kw'>for</span> <span class='ident'>i</span> <span class='kw'>in</span> <span class='number'>1</span>..(<span class='ident'>n</span> <span class='op'>/</span> <span class='number'>2</span>) { |
|||
<span class='ident'>cdata</span>[<span class='ident'>i</span>] <span class='op'>=</span> <span class='ident'>c64</span>(<span class='ident'>data</span>[<span class='number'>2</span> <span class='op'>*</span> <span class='ident'>i</span>], <span class='ident'>data</span>[<span class='number'>2</span> <span class='op'>*</span> <span class='ident'>i</span> <span class='op'>+</span> <span class='number'>1</span>]); |
|||
} |
|||
<span class='ident'>cdata</span>[<span class='ident'>n</span> <span class='op'>/</span> <span class='number'>2</span>] <span class='op'>=</span> <span class='ident'>c64</span>(<span class='ident'>data</span>[<span class='number'>1</span>], <span class='number'>0.0</span>); |
|||
<span class='kw'>for</span> <span class='ident'>i</span> <span class='kw'>in</span> (<span class='ident'>n</span> <span class='op'>/</span> <span class='number'>2</span> <span class='op'>+</span> <span class='number'>1</span>)..<span class='ident'>n</span> { |
|||
<span class='ident'>cdata</span>[<span class='ident'>i</span>] <span class='op'>=</span> <span class='ident'>cdata</span>[<span class='ident'>n</span> <span class='op'>-</span> <span class='ident'>i</span>].<span class='ident'>conj</span>(); |
|||
} |
|||
|
|||
<span class='ident'>cdata</span> |
|||
} |
|||
|
|||
<span class='kw'>fn</span> <span class='ident'>compose</span>(<span class='ident'>data</span>: <span class='kw-2'>&</span><span class='kw-2'>mut</span> [<span class='ident'>c64</span>], <span class='ident'>n</span>: <span class='ident'>usize</span>, <span class='ident'>inverse</span>: <span class='ident'>bool</span>) { |
|||
<span class='ident'>data</span>[<span class='number'>0</span>] <span class='op'>=</span> <span class='ident'>c64</span>(<span class='ident'>data</span>[<span class='number'>0</span>].<span class='ident'>re</span>() <span class='op'>+</span> <span class='ident'>data</span>[<span class='number'>0</span>].<span class='ident'>im</span>(), <span class='ident'>data</span>[<span class='number'>0</span>].<span class='ident'>re</span>() <span class='op'>-</span> <span class='ident'>data</span>[<span class='number'>0</span>].<span class='ident'>im</span>()); |
|||
<span class='kw'>if</span> <span class='ident'>inverse</span> { |
|||
<span class='ident'>data</span>[<span class='number'>0</span>] <span class='op'>=</span> <span class='ident'>data</span>[<span class='number'>0</span>] <span class='op'>*</span> <span class='number'>0.5</span>; |
|||
} |
|||
|
|||
<span class='kw'>let</span> <span class='ident'>sign</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='ident'>inverse</span> { <span class='number'>1.0</span> } <span class='kw'>else</span> { <span class='op'>-</span><span class='number'>1.0</span> }; |
|||
<span class='kw'>let</span> (<span class='ident'>multiplier</span>, <span class='kw-2'>mut</span> <span class='ident'>factor</span>) <span class='op'>=</span> { |
|||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>f64</span>::<span class='ident'>consts</span>::<span class='ident'>PI</span>; |
|||
<span class='kw'>let</span> <span class='ident'>theta</span> <span class='op'>=</span> <span class='ident'>sign</span> <span class='op'>*</span> <span class='ident'>PI</span> <span class='op'>/</span> <span class='ident'>n</span> <span class='kw'>as</span> <span class='ident'>f64</span>; |
|||
<span class='kw'>let</span> <span class='ident'>sine</span> <span class='op'>=</span> (<span class='number'>0.5</span> <span class='op'>*</span> <span class='ident'>theta</span>).<span class='ident'>sin</span>(); |
|||
(<span class='ident'>c64</span>(<span class='op'>-</span><span class='number'>2.0</span> <span class='op'>*</span> <span class='ident'>sine</span> <span class='op'>*</span> <span class='ident'>sine</span>, <span class='ident'>theta</span>.<span class='ident'>sin</span>()), <span class='ident'>c64</span>(<span class='number'>1.0</span>, <span class='number'>0.0</span>)) |
|||
}; |
|||
<span class='kw'>for</span> <span class='ident'>i</span> <span class='kw'>in</span> <span class='number'>1</span>..(<span class='ident'>n</span> <span class='op'>/</span> <span class='number'>2</span>) { |
|||
<span class='kw'>let</span> <span class='ident'>j</span> <span class='op'>=</span> <span class='ident'>n</span> <span class='op'>-</span> <span class='ident'>i</span>; |
|||
<span class='ident'>factor</span> <span class='op'>=</span> <span class='ident'>multiplier</span> <span class='op'>*</span> <span class='ident'>factor</span> <span class='op'>+</span> <span class='ident'>factor</span>; |
|||
<span class='kw'>let</span> <span class='ident'>part1</span> <span class='op'>=</span> (<span class='ident'>data</span>[<span class='ident'>i</span>] <span class='op'>+</span> <span class='ident'>data</span>[<span class='ident'>j</span>].<span class='ident'>conj</span>()) <span class='op'>*</span> <span class='number'>0.5</span>; |
|||
<span class='kw'>let</span> <span class='ident'>part2</span> <span class='op'>=</span> (<span class='ident'>data</span>[<span class='ident'>i</span>] <span class='op'>-</span> <span class='ident'>data</span>[<span class='ident'>j</span>].<span class='ident'>conj</span>()) <span class='op'>*</span> <span class='number'>0.5</span>; |
|||
<span class='kw'>let</span> <span class='ident'>product</span> <span class='op'>=</span> <span class='ident'>c64</span>(<span class='number'>0.0</span>, <span class='ident'>sign</span>) <span class='op'>*</span> <span class='ident'>factor</span> <span class='op'>*</span> <span class='ident'>part2</span>; |
|||
<span class='ident'>data</span>[<span class='ident'>i</span>] <span class='op'>=</span> <span class='ident'>part1</span> <span class='op'>+</span> <span class='ident'>product</span>; |
|||
<span class='ident'>data</span>[<span class='ident'>j</span>] <span class='op'>=</span> (<span class='ident'>part1</span> <span class='op'>-</span> <span class='ident'>product</span>).<span class='ident'>conj</span>(); |
|||
} |
|||
|
|||
<span class='ident'>data</span>[<span class='ident'>n</span> <span class='op'>/</span> <span class='number'>2</span>] <span class='op'>=</span> <span class='ident'>data</span>[<span class='ident'>n</span> <span class='op'>/</span> <span class='number'>2</span>].<span class='ident'>conj</span>(); |
|||
} |
|||
|
|||
<span class='attribute'>#[<span class='ident'>cfg</span>(<span class='ident'>test</span>)]</span> |
|||
<span class='kw'>mod</span> <span class='ident'>tests</span> { |
|||
<span class='kw'>use</span> <span class='ident'>number</span>::<span class='ident'>c64</span>; |
|||
|
|||
<span class='attribute'>#[<span class='ident'>test</span>]</span> |
|||
<span class='kw'>fn</span> <span class='ident'>unpack</span>() { |
|||
<span class='kw'>let</span> <span class='ident'>data</span> <span class='op'>=</span> (<span class='number'>0</span>..<span class='number'>4</span>).<span class='ident'>map</span>(<span class='op'>|</span><span class='ident'>i</span><span class='op'>|</span> (<span class='ident'>i</span> <span class='op'>+</span> <span class='number'>1</span>) <span class='kw'>as</span> <span class='ident'>f64</span>).<span class='ident'>collect</span>::<span class='op'><</span><span class='ident'>Vec</span><span class='op'><</span>_<span class='op'>>></span>(); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>super</span>::<span class='ident'>unpack</span>(<span class='kw-2'>&</span><span class='ident'>data</span>), <span class='macro'>vec</span><span class='macro'>!</span>[ |
|||
<span class='ident'>c64</span>(<span class='number'>1.0</span>, <span class='number'>0.0</span>), <span class='ident'>c64</span>(<span class='number'>3.0</span>, <span class='number'>4.0</span>), <span class='ident'>c64</span>(<span class='number'>2.0</span>, <span class='number'>0.0</span>), <span class='ident'>c64</span>(<span class='number'>3.0</span>, <span class='op'>-</span><span class='number'>4.0</span>), |
|||
]); |
|||
|
|||
<span class='kw'>let</span> <span class='ident'>data</span> <span class='op'>=</span> (<span class='number'>0</span>..<span class='number'>8</span>).<span class='ident'>map</span>(<span class='op'>|</span><span class='ident'>i</span><span class='op'>|</span> (<span class='ident'>i</span> <span class='op'>+</span> <span class='number'>1</span>) <span class='kw'>as</span> <span class='ident'>f64</span>).<span class='ident'>collect</span>::<span class='op'><</span><span class='ident'>Vec</span><span class='op'><</span>_<span class='op'>>></span>(); |
|||
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>super</span>::<span class='ident'>unpack</span>(<span class='kw-2'>&</span><span class='ident'>data</span>), <span class='macro'>vec</span><span class='macro'>!</span>[ |
|||
<span class='ident'>c64</span>(<span class='number'>1.0</span>, <span class='number'>0.0</span>), <span class='ident'>c64</span>(<span class='number'>3.0</span>, <span class='number'>4.0</span>), <span class='ident'>c64</span>(<span class='number'>5.0</span>, <span class='number'>6.0</span>), <span class='ident'>c64</span>(<span class='number'>7.0</span>, <span class='number'>8.0</span>), |
|||
<span class='ident'>c64</span>(<span class='number'>2.0</span>, <span class='number'>0.0</span>), <span class='ident'>c64</span>(<span class='number'>7.0</span>, <span class='op'>-</span><span class='number'>8.0</span>), <span class='ident'>c64</span>(<span class='number'>5.0</span>, <span class='op'>-</span><span class='number'>6.0</span>), <span class='ident'>c64</span>(<span class='number'>3.0</span>, <span class='op'>-</span><span class='number'>4.0</span>), |
|||
]); |
|||
} |
|||
} |
|||
</pre> |
|||
</section> |
|||
<section id='search' class="content hidden"></section> |
|||
|
|||
<section class="footer"></section> |
|||
|
|||
<div id="help" class="hidden"> |
|||
<div class="shortcuts"> |
|||
<h1>Keyboard shortcuts</h1> |
|||
<dl> |
|||
<dt>?</dt> |
|||
<dd>Show this help dialog</dd> |
|||
<dt>S</dt> |
|||
<dd>Focus the search field</dd> |
|||
<dt>⇤</dt> |
|||
<dd>Move up in search results</dd> |
|||
<dt>⇥</dt> |
|||
<dd>Move down in search results</dd> |
|||
<dt>⏎</dt> |
|||
<dd>Go to active search result</dd> |
|||
</dl> |
|||
</div> |
|||
<div class="infos"> |
|||
<h1>Search tricks</h1> |
|||
<p> |
|||
Prefix searches with a type followed by a colon (e.g. |
|||
<code>fn:</code>) to restrict the search to a given type. |
|||
</p> |
|||
<p> |
|||
Accepted types are: <code>fn</code>, <code>mod</code>, |
|||
<code>struct</code>, <code>enum</code>, |
|||
<code>trait</code>, <code>typedef</code> (or |
|||
<code>tdef</code>). |
|||
</p> |
|||
<p> |
|||
Search functions by type signature (e.g. |
|||
<code>vec -> usize</code>) |
|||
</p> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
|
|||
<script> |
|||
window.rootPath = "../../"; |
|||
window.currentCrate = "dft"; |
|||
window.playgroundUrl = ""; |
|||
</script> |
|||
<script src="../../jquery.js"></script> |
|||
<script src="../../main.js"></script> |
|||
|
|||
<script async src="../../search-index.js"></script> |
|||
</body> |
|||
</html> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue