-
Notifications
You must be signed in to change notification settings - Fork 49
/
customcollections.html
44 lines (38 loc) · 12 KB
/
customcollections.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Custom collection types · RigidBodyDynamics.jl</title><link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.min.css" rel="stylesheet" type="text/css"/><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js" data-main="assets/documenter.js"></script><script src="siteinfo.js"></script><script src="../versions.js"></script><link href="assets/documenter.css" rel="stylesheet" type="text/css"/></head><body><nav class="toc"><h1>RigidBodyDynamics.jl</h1><select id="version-selector" onChange="window.location.href=this.value" style="visibility: hidden"></select><form class="search" id="search-form" action="search.html"><input id="search-query" name="q" type="text" placeholder="Search docs"/></form><ul><li><a class="toctext" href="index.html">Home</a></li><li><a class="toctext" href="quickstart.html">Quick start guide</a></li><li><a class="toctext" href="spatial.html">Spatial vector algebra</a></li><li><a class="toctext" href="joints.html">Joints</a></li><li><a class="toctext" href="rigidbody.html">Rigid bodies</a></li><li><a class="toctext" href="mechanism.html">Mechanism</a></li><li><a class="toctext" href="mechanismstate.html">MechanismState</a></li><li><a class="toctext" href="algorithms.html">Kinematics/dynamics algorithms</a></li><li class="current"><a class="toctext" href="customcollections.html">Custom collection types</a><ul class="internal"><li><a class="toctext" href="#Index-1">Index</a></li><li><a class="toctext" href="#Types-1">Types</a></li></ul></li><li><a class="toctext" href="caches.html">Cache types</a></li><li><a class="toctext" href="simulation.html">Simulation</a></li><li><a class="toctext" href="benchmarks.html">Benchmarks</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href="customcollections.html">Custom collection types</a></li></ul><a class="edit-page" href="https://github.com/JuliaRobotics/RigidBodyDynamics.jl/blob/master/docs/src/customcollections.md"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>Custom collection types</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Custom-collection-types-1" href="#Custom-collection-types-1">Custom collection types</a></h1><h2><a class="nav-anchor" id="Index-1" href="#Index-1">Index</a></h2><ul><li><a href="customcollections.html#RigidBodyDynamics.CustomCollections.CacheIndexDict"><code>RigidBodyDynamics.CustomCollections.CacheIndexDict</code></a></li><li><a href="customcollections.html#RigidBodyDynamics.CustomCollections.ConstVector"><code>RigidBodyDynamics.CustomCollections.ConstVector</code></a></li><li><a href="customcollections.html#RigidBodyDynamics.CustomCollections.DiscardVector"><code>RigidBodyDynamics.CustomCollections.DiscardVector</code></a></li><li><a href="customcollections.html#RigidBodyDynamics.CustomCollections.IndexDict"><code>RigidBodyDynamics.CustomCollections.IndexDict</code></a></li><li><a href="customcollections.html#RigidBodyDynamics.CustomCollections.NullDict"><code>RigidBodyDynamics.CustomCollections.NullDict</code></a></li><li><a href="customcollections.html#RigidBodyDynamics.CustomCollections.SegmentedBlockDiagonalMatrix"><code>RigidBodyDynamics.CustomCollections.SegmentedBlockDiagonalMatrix</code></a></li><li><a href="customcollections.html#RigidBodyDynamics.CustomCollections.SegmentedVector"><code>RigidBodyDynamics.CustomCollections.SegmentedVector</code></a></li></ul><h2><a class="nav-anchor" id="Types-1" href="#Types-1">Types</a></h2><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="RigidBodyDynamics.CustomCollections.CacheIndexDict" href="#RigidBodyDynamics.CustomCollections.CacheIndexDict"><code>RigidBodyDynamics.CustomCollections.CacheIndexDict</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-julia">type CacheIndexDict{K, KeyRange<:AbstractUnitRange{K}, V} <: RigidBodyDynamics.CustomCollections.AbstractIndexDict{K,V}</code></pre><p>Like <a href="customcollections.html#RigidBodyDynamics.CustomCollections.IndexDict"><code>IndexDict</code></a>, but contains an additional <code>Bool</code> dirty bit to be used in algorithms involving cached data.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaRobotics/RigidBodyDynamics.jl/blob/611aaf052afe52969b1f4ce8ee81129969ee8864/src/custom_collections.jl#L145">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="RigidBodyDynamics.CustomCollections.ConstVector" href="#RigidBodyDynamics.CustomCollections.ConstVector"><code>RigidBodyDynamics.CustomCollections.ConstVector</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-julia">struct ConstVector{T} <: AbstractArray{T,1}</code></pre><p>An immutable <code>AbstractVector</code> for which all elements are the same, represented compactly and as an isbits type if the element type is <code>isbits</code>.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaRobotics/RigidBodyDynamics.jl/blob/611aaf052afe52969b1f4ce8ee81129969ee8864/src/custom_collections.jl#L63">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="RigidBodyDynamics.CustomCollections.DiscardVector" href="#RigidBodyDynamics.CustomCollections.DiscardVector"><code>RigidBodyDynamics.CustomCollections.DiscardVector</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-julia">bitstype 64 DiscardVector <: AbstractArray{Any,1}</code></pre><p><code>DiscardVector</code> is an <code>AbstractVector</code> whose <code>setindex!</code> simply discards the value. This is useful for <code>broadcast!</code> calls where the output of the broadcasted function is not interesting, specifically when the broadcasted function is in-place and there are arguments that need to be treated as scalars, so that a simple foreach doesn't do the job.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaRobotics/RigidBodyDynamics.jl/blob/611aaf052afe52969b1f4ce8ee81129969ee8864/src/custom_collections.jl#L340">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="RigidBodyDynamics.CustomCollections.IndexDict" href="#RigidBodyDynamics.CustomCollections.IndexDict"><code>RigidBodyDynamics.CustomCollections.IndexDict</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-julia">struct IndexDict{K, KeyRange<:AbstractUnitRange{K}, V} <: RigidBodyDynamics.CustomCollections.AbstractIndexDict{K,V}</code></pre><p>An associative type whose keys are an <code>AbstractUnitRange</code>, and whose values are stored in a <code>Vector</code>. <code>IndexDict</code> is an ordered associative collection, with the order determined by key range. The nature of the keys enables very fast lookups and stores.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> IndexDict(2 : 4, [4, 5, 6])
RigidBodyDynamics.CustomCollections.IndexDict{Int64,UnitRange{Int64},Int64} with 3 entries:
2 => 4
3 => 5
4 => 6
julia> IndexDict{Int32, UnitRange{Int32}}(i => 3 * i for i in Int32[4, 2, 3])
RigidBodyDynamics.CustomCollections.IndexDict{Int32,UnitRange{Int32},Int64} with 3 entries:
2 => 6
3 => 9
4 => 12</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaRobotics/RigidBodyDynamics.jl/blob/611aaf052afe52969b1f4ce8ee81129969ee8864/src/custom_collections.jl#L113">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="RigidBodyDynamics.CustomCollections.NullDict" href="#RigidBodyDynamics.CustomCollections.NullDict"><code>RigidBodyDynamics.CustomCollections.NullDict</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-julia">struct NullDict{K, V} <: Associative{K,V}</code></pre><p>An immutable associative type that signifies an empty dictionary and does not allocate any memory.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaRobotics/RigidBodyDynamics.jl/blob/611aaf052afe52969b1f4ce8ee81129969ee8864/src/custom_collections.jl#L79">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="RigidBodyDynamics.CustomCollections.SegmentedBlockDiagonalMatrix" href="#RigidBodyDynamics.CustomCollections.SegmentedBlockDiagonalMatrix"><code>RigidBodyDynamics.CustomCollections.SegmentedBlockDiagonalMatrix</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-julia">struct SegmentedBlockDiagonalMatrix{T, M<:AbstractArray{T,2}} <: AbstractArray{T,2}</code></pre><p><code>SegmentedBlockDiagonalMatrix</code> is an <code>AbstractMatrix</code> backed by a parent <code>AbstractMatrix</code>, which additionally stores a sequence of views into the diagonal blocks of the parent matrix. This type is useful for storing and updating block-diagonal matrices whose block contents may change but whose overall structure is fixed, such as configuration derivative <-> velocity jacobians.</p></div><a class="source-link" target="_blank" href="https://github.com/JuliaRobotics/RigidBodyDynamics.jl/blob/611aaf052afe52969b1f4ce8ee81129969ee8864/src/custom_collections.jl#L378">source</a></section><section class="docstring"><div class="docstring-header"><a class="docstring-binding" id="RigidBodyDynamics.CustomCollections.SegmentedVector" href="#RigidBodyDynamics.CustomCollections.SegmentedVector"><code>RigidBodyDynamics.CustomCollections.SegmentedVector</code></a> — <span class="docstring-category">Type</span>.</div><div><pre><code class="language-julia">struct SegmentedVector{K, T, KeyRange<:Range{K}, P<:AbstractArray{T,1}} <: AbstractArray{T,1}</code></pre><p><code>SegmentedVector</code> is an <code>AbstractVector</code> backed by another <code>AbstractVector</code> (its parent), which additionally stores an <a href="customcollections.html#RigidBodyDynamics.CustomCollections.IndexDict"><code>IndexDict</code></a> containing views into the parent. Together, these views cover the parent.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl">julia> x = [1., 2., 3., 4.]
4-element Array{Float64,1}:
1.0
2.0
3.0
4.0
julia> viewlength(i) = 2
viewlength (generic function with 1 method)
julia> xseg = SegmentedVector{Int}(x, 1 : 2, viewlength)
4-element RigidBodyDynamics.CustomCollections.SegmentedVector{Int64,Float64,Base.OneTo{Int64},Array{Float64,1}}:
1.0
2.0
3.0
4.0
julia> segments(xseg)[1]
2-element SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true}:
1.0
2.0
julia> yseg = similar(xseg, Int32); yseg .= 1 : 4 # same view ranges, different element type
4-element RigidBodyDynamics.CustomCollections.SegmentedVector{Int64,Int32,Base.OneTo{Int64},Array{Int32,1}}:
1
2
3
4
julia> segments(yseg)[2]
2-element SubArray{Int32,1,Array{Int32,1},Tuple{UnitRange{Int64}},true}:
3
4</code></pre></div><a class="source-link" target="_blank" href="https://github.com/JuliaRobotics/RigidBodyDynamics.jl/blob/611aaf052afe52969b1f4ce8ee81129969ee8864/src/custom_collections.jl#L230">source</a></section><footer><hr/><a class="previous" href="algorithms.html"><span class="direction">Previous</span><span class="title">Kinematics/dynamics algorithms</span></a><a class="next" href="caches.html"><span class="direction">Next</span><span class="title">Cache types</span></a></footer></article></body></html>