1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4<head> 5<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> 6<link rel="stylesheet" href="../../../../boost.css" type="text/css"/> 7<link rel="stylesheet" href="ublas.css" type="text/css" /> 8<script type="text/javascript" src="js/jquery-1.3.2.min.js" async="async" ></script> 9<script type="text/javascript" src="js/jquery.toc-gw.js" async="async" ></script> 10<script type="text/x-mathjax-config"> 11MathJax.Hub.Config({ 12 jax: ["input/TeX", "output/HTML-CSS"], 13 extensions: ["tex2jax.js"], 14 "HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"], scale: "80" }, 15 tex2jax: { 16 inlineMath: [ ["$", "$"], ["\\(","\\)"] ], 17 displayMath: [ ["$$","$$"], ["\\[", "\\]"] ], 18 processEscapes: true, 19 ignoreClass: "tex2jax_ignore|dno" }, 20 TeX: { noUndefined: { attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" } } }, 21 messageStyle: "none" 22 }); 23</script> 24<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js"></script> 25 26<title>Strides</title> 27</head> 28<body> 29<h1><img src="../../../../boost.png" align="middle" />Strides</h1> 30<div class="toc" id="toc"></div> 31<h2><a name="extents"></a>basic_strides<size_type, format_type></h2> 32<h4>Description</h4> 33<p>The template class <code>basic_strides</code> contains weights for a given storage format in order to map multi-indices to scalar memory indices for <a href= 34"../tensor.html#tensor">tensor</a> instances.</p> 35 36<h4>Example</h4> 37<pre> 38#include <boost/numeric/ublas/tensor/strides.hpp> 39 40int main () { 41 <b>using namespace</b> boost::numeric::ublas; 42 <b>auto</b> wf = strides<first_order>(shape{4,3,2}); 43 for (<b>auto</b> i = 0u; i < wf.size(); ++i) 44 std::cout << wf.at(i) << std::endl; 45 // 1,4,12 46 47 <b>auto</b> wl = strides<first_order>(shape{4,3,2}); 48 for (<b>auto</b> i = 0u; i < wl.size(); ++i) 49 std::cout << wl.at(i) << std::endl; 50 // 6,2,1 51} 52</pre> 53<h4>Definition</h4> 54<p>Defined in the header tensor/strides.hpp.</p> 55 56<h4>Public base classes</h4> 57<p>None.</p> 58 59<h4>Specialization</h4> 60<p><code><b>template</b><<b>class</b> format_t><br><b>using</b> strides = basic_strides<std::size_t,format_t></code></p> 61 62 63<h4>Template parameters</h4> 64<table border="1" style="font-size:100%" summary="parameters"> 65<tbody style="font-size:100%"> 66<tr> 67<th>Parameter</th> 68<th>Description</th> 69</tr> 70<tr> 71<td><code>size_type</code></td> 72<td>Unsigned integer type.</td> 73</tr> 74</tbody> 75</table> 76 77<h4>Member types</h4> 78<table border="1" style="font-size:100%" summary="members"> 79<tbody style="font-size:100%" > 80<tr> 81<th>Member type</th> 82<th>Description</th> 83</tr> 84<tr> 85<td><code>value_type</code></td> 86<td>Type <code>size_type</code> of the strides.</td> 87</tr> 88<tr> 89<td><code>size_type</code></td> 90<td>Unsigned integer such as <code>std::size_t</code>.</td> 91</tr> 92<tr> 93<td><code>reference</code></td> 94<td>Reference type which is <code>value_type&</code>.</td> 95</tr> 96<tr> 97<td><code>const_reference</code></td> 98<td>Constant reference type which is <code>const value_type&</code>.</td> 99</tr> 100<tr> 101<td><code>pointer</code></td> 102<td>Pointer type which is <code>value_type*</code>.</td> 103</tr> 104<tr> 105<td><code>const_pointer</code></td> 106<td>Constant pointer type which is <code>const value_type*</code>.</td> 107</tr> 108<tr> 109<td><code>layout_type</code></td> 110<td>Layout type which can be either <code>boost::numeric::ublas::first_order</code> or <code>boost::numeric::ublas::last_order</code>.</td> 111</tr> 112 113</tbody> 114</table> 115 116 117 118 119<h4>Member Functions</h4> 120<table border="1" summary="members functions"> 121<tbody> 122<tr> 123<th>Member Function</th> 124<th>Description</th> 125</tr> 126<tr> 127<td><code>basic_strides ()</code></td> 128<td>Constructs an empty instance of <code>basic_strides</code>.</td> 129</tr> 130<tr> 131<td><code>basic_strides (basic_extents<value_type> const& be)</code></td> 132<td>Constructs an instance based on the tensor extents specified by <code>be</code>.</td> 133</tr> 134<tr> 135<td><code>basic_strides (std::vector<value_type> const& v)</code></td> 136<td>Constructs an instance copying the content of <code>v</code>.</td> 137</tr> 138<tr> 139<td><code>basic_strides (std::vector<value_type> && v)</code></td> 140<td>Constructs an instance moving the content of <code>v</code>.</td> 141</tr> 142<tr> 143<td><code>basic_strides (basic_strides const& other)</code></td> 144<td>Constructs an instance from <code>other</code> copying its elements.</td> 145</tr> 146<tr> 147<td><code>basic_strides (basic_strides && other)</code></td> 148<td>Constructs an instance from <code>other</code> by moving its elements.</td> 149</tr> 150<tr> 151<td><code>basic_strides& operator= (basic_strides other)</code></td> 152<td>Assigns the elements of <code>other</code> to this instance.</td> 153</tr> 154<tr> 155<td><code>const_pointer data() const</code></td> 156<td>Returns a <code>const_pointer</code> to the first element.</td> 157</tr> 158<tr> 159<td><code>const_reference operator[](size_type i) const</code></td> 160<td>Returns a <code>const_reference</code> to the <code>i</code>-th element.</td> 161</tr> 162<tr> 163<td><code>const_reference at(size_type i) const</code></td> 164<td>Returns a <code>const_reference</code> to the <code>i</code>-th element.</td> 165</tr> 166<tr> 167<td><code>bool empty()</code></td> 168<td>Returns true if the container has no elements.</td> 169</tr> 170<tr> 171<td><code>size_type size() const</code></td> 172<td>Returns the number of elements.</td> 173</tr> 174<tr> 175<td><code>void clear()</code></td> 176<td>Erases all elements.</td> 177</tr> 178<tr> 179<td><code>bool operator==(basic_strides const& b) const</code></td> 180<td>Returns true if all elements are equal.</td> 181</tr> 182<tr> 183<td><code>bool operator!=(basic_strides const& b) const</code></td> 184<td>Returns true if some elements are not equal.</td> 185</tr> 186<tr> 187<td><code>const_iterator begin() const</code></td> 188<td>Returns an <code>const_iterator</code> pointing to the first element.</td> 189</tr> 190<tr> 191<td><code>const_iterator end() const</code></td> 192<td>Returns a <code>const_iterator</code> pointing to an element passed the last element.</td> 193</tr> 194<tr> 195<td><code>std::vector<size_type> base() const</code></td> 196<td>Returns the private member sequence container holding all elements.</td> 197</tr> 198</tbody> 199</table> 200 201 202 203<h4>Non-Member Functions</h4> 204<table border="1" summary="members functions"> 205<tbody> 206<tr> 207<th>Function</th> 208<th>Description</th> 209</tr> 210<tr> 211<td><code>access(std::vector<size_type> const& i, strides<layout_type> w)</code></td> 212<td>Returns relative memory location depending on the multi-index vector <code>i</code> and strides <code>w</code>.</td> 213</tr> 214<tr> 215<td><code>access(size_type sum, strides<layout_type> w, size_type i, size_types ... is)</code></td> 216<td>Returns relative memory location depending on the indices <code>i</code>, <code>is ... </code> and stride vector <code>w</code> (recursive function).</td> 217</tr> 218</tbody> 219</table> 220 221 222<hr /> 223<p> 224Copyright (©) 2018 Cem Bassoy<br /> 225 Use, modification and distribution are subject to the 226 Boost Software License, Version 1.0. 227 (See accompanying file LICENSE_1_0.txt 228 or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"> 229 http://www.boost.org/LICENSE_1_0.txt 230 </a>). 231</p> 232<script type="text/javascript"> 233(function($) { 234 $('#toc').toc(); 235})(jQuery); 236</script> 237</body> 238</html> 239