• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>Shape</title>
27</head>
28<body>
29<h1><img src="../../../../boost.png" align="middle" />Extents</h1>
30<div class="toc" id="toc"></div>
31<h2><a name="extents"></a>basic_extents&lt;size_type&gt;</h2>
32<h4>Description</h4>
33<p>The template class <code>basic_extents</code> specifies dimension extents of a  <a href=
34"../tensor.html#tensor">tensor</a> instance.</p>
35
36<h4>Example</h4>
37<pre>
38#include &lt;boost/numeric/ublas/tensor/extents.hpp&gt;
39
40int main () {
41    <b>using namespace</b> boost::numeric::ublas;
42    shape s{4,3,2};
43    for (<b>auto</b> i = 0u; i &lt; s.size(); ++i) {
44        std::cout &lt;&lt; s.at(i) &lt;&lt; std::endl;
45    }
46}
47</pre>
48<h4>Definition</h4>
49<p>Defined in the header tensor/extents.hpp.</p>
50
51<h4>Public base classes</h4>
52<p>None.</p>
53
54<h4>Specialization</h4>
55<p><code><b>using</b> shape = basic_extents&lt;std::size_t&gt;</code></p>
56
57
58<h4>Template parameters</h4>
59<table border="1" style="font-size:100%" summary="parameters">
60<tbody style="font-size:100%">
61<tr>
62<th>Parameter</th>
63<th>Description</th>
64</tr>
65<tr>
66<td><code>size_type</code></td>
67<td>Unsigned integer type.</td>
68</tr>
69</tbody>
70</table>
71
72<h4>Member types</h4>
73<table border="1" style="font-size:100%" summary="members">
74<tbody style="font-size:100%" >
75<tr>
76<th>Member type</th>
77<th>Description</th>
78</tr>
79<tr>
80<td><code>value_type</code></td>
81<td>Type <code>size_type</code> of the extents.</td>
82</tr>
83<tr>
84<td><code>size_type</code></td>
85<td>Unsigned integer such as <code>std::size_t</code>.</td>
86</tr>
87<tr>
88<td><code>reference</code></td>
89<td>Reference type which is <code>value_type&</code>.</td>
90</tr>
91<tr>
92<td><code>const_reference</code></td>
93<td>Constant reference type which is <code>const value_type&</code>.</td>
94</tr>
95<tr>
96<td><code>pointer</code></td>
97<td>Pointer type which is <code>value_type*</code>.</td>
98</tr>
99<tr>
100<td><code>const_pointer</code></td>
101<td>Constant reference type which is <code>const value_type*</code>.</td>
102</tr>
103</tbody>
104</table>
105
106
107
108
109<h4>Member Functions</h4>
110<table border="1" summary="members functions">
111<tbody>
112<tr>
113<th>Member Function</th>
114<th>Description</th>
115</tr>
116<tr>
117<td><code>basic_extents ()</code></td>
118<td>Constructs an empty instance of <code>basic_extents</code>.</td>
119</tr>
120<tr>
121<td><code>basic_extents (std::vector&lt;value_type&gt; const& vector)</code></td>
122<td>Constructs an instance copying the content of <code>vector</code>.</td>
123</tr>
124<tr>
125<td><code>basic_extents (std::vector&lt;value_type&gt; && vector)</code></td>
126<td>Constructs an instance moving the content of <code>vector</code>.</td>
127</tr>
128<tr>
129<td><code>basic_extents (std::initializer_list&lt;value_type&gt; list)</code></td>
130<td>Constructs an instance from <code>list</code>.</td>
131</tr>
132<tr>
133<td><code>basic_extents (const_iterator first, const_iterator last)</code></td>
134<td>Constructs an instance from the range specified by <code>[first</code>,<code>last)</code>.</td>
135</tr>
136<tr>
137<td><code>basic_extents (basic_extents const& other)</code></td>
138<td>Constructs an instance from <code>other</code> copying its elements.</td>
139</tr>
140<tr>
141<td><code>basic_extents (basic_extents && other)</code></td>
142<td>Constructs an instance from <code>other</code> by moving its elements.</td>
143</tr>
144<tr>
145<td><code>basic_extents& operator= (basic_extents other)</code></td>
146<td>Assigns the elements of <code>other</code> to this instance.</td>
147</tr>
148<tr>
149<td><code>bool is_scalar() const</code></td>
150<td>Returns true if the elements are <code>(1,1,[1,...,1])</code>.</td>
151</tr>
152<tr>
153<td><code>bool is_vector() const</code></td>
154<td>Returns true if the elements are <code>(n,1,[1,...,1])</code> or <code>(1,n,[1,...,1])</code> where <code>n>1</code>.</td>
155</tr>
156<tr>
157<td><code>bool is_matrix() const</code></td>
158<td>Returns true if the elements are <code>(m,n,[1,...,1])</code> where <code>m>1</code> and <code>n>1</code>.</td>
159</tr>
160<tr>
161<td><code>bool is_tensor() const</code></td>
162<td>Returns true if it is not a scalar, vector or matrix.</td>
163</tr>
164<tr>
165<td><code>const_pointer data() const</code></td>
166<td>Returns a <code>const_pointer</code> to the first element.</td>
167</tr>
168<tr>
169<td><code>pointer data()</code></td>
170<td>Returns a <code>pointer</code> to the first element.</td>
171</tr>
172<tr>
173<td><code>reference operator[](size_type i)</code></td>
174<td>Returns a <code>reference</code> to the <code>i</code>-th element.</td>
175</tr>
176<tr>
177<td><code>const_reference operator[](size_type i) const</code></td>
178<td>Returns a <code>const_reference</code> to the <code>i</code>-th element.</td>
179</tr>
180<tr>
181<td><code>reference at(size_type i)</code></td>
182<td>Returns a <code>reference</code> to the <code>i</code>-th element.</td>
183</tr>
184<tr>
185<td><code>const_reference at(size_type i) const</code></td>
186<td>Returns a <code>const_reference</code> to the <code>i</code>-th element.</td>
187</tr>
188<tr>
189<td><code>bool empty()</code></td>
190<td>Returns true if the container has no elements.</td>
191</tr>
192<tr>
193<td><code>size_type size() const</code></td>
194<td>Returns the number of elements.</td>
195</tr>
196<tr>
197<td><code>bool valid() const</code></td>
198<td>Returns true if size()>1 and all elements are greater than one.</td>
199</tr>
200<tr>
201<td><code>size_type product() const</code></td>
202<td>Returns the multiplication of all entries.</td>
203</tr>
204<tr>
205<td><code>basic_extents squeeze() const</code></td>
206<td>Returns a new instance where entries equal to one are eliminated.</td>
207</tr>
208<tr>
209<td><code>bool operator==(basic_extents const& b) const</code></td>
210<td>Returns true if all elements are equal.</td>
211</tr>
212<tr>
213<td><code>bool operator!=(basic_extents const& b) const</code></td>
214<td>Returns true if some elements are not equal.</td>
215</tr>
216<tr>
217<td><code>const_iterator begin() const</code></td>
218<td>Returns an <code>const_iterator<code> pointing to the first element.</td>
219</tr>
220<tr>
221<td><code>const_iterator end() const</code></td>
222<td>Returns a <code>const_iterator</code> pointing to an element passed the last element.</td>
223</tr>
224<tr>
225<td><code>std::vector&lt;size_type&gt; base() const</code></td>
226<td>Returns a const reference to the private member sequence container holding all elements.</td>
227</tr>
228</tbody>
229</table>
230
231
232
233
234<hr />
235<p>
236Copyright (&copy;) 2018 Cem Bassoy<br />
237   Use, modification and distribution are subject to the
238   Boost Software License, Version 1.0.
239   (See accompanying file LICENSE_1_0.txt
240   or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
241      http://www.boost.org/LICENSE_1_0.txt
242   </a>).
243</p>
244<script type="text/javascript">
245(function($) {
246    $('#toc').toc();
247})(jQuery);
248</script>
249</body>
250</html>
251