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