tensor.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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 name="generator" content="Bluefish 2.2.10" />
  6. <meta http-equiv="Content-Type" content=
  7. "text/html; charset=us-ascii" />
  8. <link rel="stylesheet" href="../../../../boost.css" type="text/css"/>
  9. <link rel="stylesheet" href="ublas.css" type="text/css" />
  10. <script type="text/javascript" src="js/jquery-1.3.2.min.js" async="async" ></script>
  11. <script type="text/javascript" src="js/jquery.toc-gw.js" async="async" ></script>
  12. <script type="text/x-mathjax-config">
  13. MathJax.Hub.Config({
  14. jax: ["input/TeX", "output/HTML-CSS"],
  15. extensions: ["tex2jax.js"],
  16. "HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"], scale: "80" },
  17. tex2jax: {
  18. inlineMath: [ ["$", "$"], ["\\(","\\)"] ],
  19. displayMath: [ ["$$","$$"], ["\\[", "\\]"] ],
  20. processEscapes: true,
  21. ignoreClass: "tex2jax_ignore|dno" },
  22. TeX: { noUndefined: { attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" } } },
  23. messageStyle: "none"
  24. });
  25. </script>
  26. <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js"></script>
  27. <title>Tensor</title>
  28. </head>
  29. <body>
  30. <h1><img src="../../../../boost.png" align="middle" />Tensor</h1>
  31. <div class="toc" id="toc"></div>
  32. <h2><a name="tensor"></a>Tensor</h2>
  33. <h4>Description</h4>
  34. <p>The templated class <code>tensor&lt;value_t,format_t,storage_t&gt;</code> is the base container adaptor for dense tensors.
  35. Every element $t_{i_1,i_2,\dots,i_p}$ of a $p$-order $(n_1 \times n_2 \times \cdots \times n_p)$-dimensional tensor $T$ is mapped to $j$-th element of a one-dimensional container where $j = \sum_{r=1}^p i_r \cdot w_r$ with $1 \leq i_r \leq n_r $ for $1 \leq r \leq p$.
  36. For the first-order orientation $w_1 = 1$ and $w_k = n_{k-1} \cdot w_{k-1}$ for $k > 1$. For last-order orientation $w_p = 1$ and $ w_k = n_{k+1} \cdot w_{k+1}$ for $k < p$.
  37. </p>
  38. <h4>Example</h4>
  39. <pre>
  40. <b>#include</b> &lt;boost/numeric/ublas/tensor.hpp&gt;
  41. <b>int</b> main () {
  42. <b>using namespace</b> boost::numeric::ublas;
  43. tensor&lt;<b>double</b>&gt; t{4,2,3};
  44. <b>for</b> (<b>auto</b> k = 0ul; k &lt; t.size (2); ++ k)
  45. <b>for</b> (<b>auto</b> j = 0ul; j &lt; t.size (1); ++ j)
  46. <b>for</b> (<b>auto</b> i = 0ul; i &lt; t.size (0); ++ i)
  47. t.at(i,j,k) = 3*i + 2*j + 5*k;
  48. std::cout &lt;&lt; t &lt;&lt; std::endl;
  49. }
  50. </pre>
  51. <h4>Definition</h4>
  52. <p>Defined in the header file <code>tensor/tensor.hpp</code>.</p>
  53. <h4>Model of</h4>
  54. <p><a href="container_concept.html#tensor">Tensor</a></p>
  55. <h4>Type requirements</h4>
  56. <p>None, except for those imposed by the requirements of <a href="container_concept.html#tensor">Tensor</a> .</p>
  57. <h4>Public base classes</h4>
  58. <p><code>tensor_container&lt;tensor&lt;value_t,format_t,storage_t&gt; &gt;</code></p>
  59. <h4>Template parameters</h4>
  60. <table border="1" summary="parameters">
  61. <tbody>
  62. <tr>
  63. <th>Parameter</th>
  64. <th>Description</th>
  65. <th>Default</th>
  66. </tr>
  67. <tr>
  68. <td><code>value_t</code></td>
  69. <td>The type of object stored in the tensor.</td>
  70. <td></td>
  71. </tr>
  72. <tr>
  73. <td><code>format_t</code></td>
  74. <td>Storage organization. <a href=
  75. "#tensor_1">[1]</a></td>
  76. <td><code>first_order</code></td>
  77. </tr>
  78. <tr>
  79. <td><code>storage_t</code></td>
  80. <td>The type of the Storage array. <a href="#tensor_2">[2]</a></td>
  81. <td><code>std::vector&lt;value_t&gt;</code></td>
  82. </tr>
  83. </tbody>
  84. </table>
  85. <h4>Member types</h4>
  86. <table border="1" style="font-size:100%" summary="members">
  87. <tbody style="font-size:100%" >
  88. <tr>
  89. <th>Member type</th>
  90. <th>Description</th>
  91. </tr>
  92. <tr>
  93. <td><code>value_type</code></td>
  94. <td>Type <code>value_t</code> of the tensor elements.</td>
  95. </tr>
  96. <tr>
  97. <td><code>layout_type</code></td>
  98. <td>Format of the tensor which is either <code>first_order</code> or <code>last_order</code>.</td>
  99. </tr>
  100. <tr>
  101. <td><code>array_type</code></td>
  102. <td>Sequence container type that stores all tensor elements and is accessible with a single index.</td>
  103. </tr>
  104. <tr>
  105. <td><code>strides_type</code></td>
  106. <td>Type of the strides vector <code>basic_strides&lt;std::size_t,layout_type&gt;</code> that stores all tensor elements and is accessible with a single index.</td>
  107. </tr>
  108. <tr>
  109. <td><code>extents_type</code></td>
  110. <td>Type of the dimension extents vector <code>shape</code> that stores all tensor elements and is accessible with a single index.</td>
  111. </tr>
  112. <tr>
  113. <td><code>size_type</code></td>
  114. <td>Unsigned integer which is usually <code>std::size_t</code>.</td>
  115. </tr>
  116. <tr>
  117. <td><code>difference_type</code></td>
  118. <td>Unsigned integer which is usually <code>std::ptrdiff_t</code>.</td>
  119. </tr>
  120. <tr>
  121. <td><code>reference</code></td>
  122. <td>Reference type <code>storage_type::reference</code> which is in most cases <code>value_type&</code>.</td>
  123. </tr>
  124. <tr>
  125. <td><code>const_reference</code></td>
  126. <td>Constant reference type <code>storage_type::const_reference</code> which is in most cases <code>const value_type&</code>.</td>
  127. </tr>
  128. <tr>
  129. <td><code>pointer</code></td>
  130. <td>Pointer type <code>storage_type::pointer</code> which is in most cases <code>value_type*</code>.</td>
  131. </tr>
  132. <tr>
  133. <td><code>const_pointer</code></td>
  134. <td>Constant reference type <code>storage_type::const_reference</code> which is in most cases <code>const value_type*</code>.</td>
  135. </tr>
  136. <tr>
  137. <td><code>iterator</code></td>
  138. <td>RandomAccessIterator <code>storage_type::iterator</code>.</td>
  139. </tr>
  140. <tr>
  141. <td><code>const_iterator</code></td>
  142. <td>Constant RandomAccessIterator <code>storage_type::const_iterator</code>.</td>
  143. </tr>
  144. <tr>
  145. <td><code>reverse_iterator</code></td>
  146. <td>Reverse RandomAccessIterator <code>storage_type::reverse_iterator</code>.</td>
  147. </tr>
  148. <tr>
  149. <td><code>const_reverse_iterator</code></td>
  150. <td>Reverse RandomAccessIterator <code>storage_type::const_reverse_iterator</code>.</td>
  151. </tr>
  152. <tr>
  153. <td><code>matrix_type</code></td>
  154. <td>Type of the matrix <code>matrix&lt;value_type,layout_type,array_type&gt;</code> with which the tensor type interacts.</td>
  155. </tr>
  156. <tr>
  157. <td><code>vector_type</code></td>
  158. <td>Type of the vector <code>matrix&lt;value_type,layout_type,array_type&gt;</code> with which the tensor type interacts.</td>
  159. </tr>
  160. </tbody>
  161. </table>
  162. <h4>Alias templates</h4>
  163. <table border="1" style="font-size:100%" summary="members">
  164. <tbody style="font-size:100%" >
  165. <tr>
  166. <th>Alias template</th>
  167. <th>Description</th>
  168. <tr>
  169. <td><code>template&lt;class derived_type&gt; <br> using tensor_expression_type = detail::tensor_expression&lt;self_type,derived_type&gt;</code></td>
  170. <td>Type of <a href= "tensor/tensor_expression.html#tensor_expression">tensor_expression</a> where <code>self_type</code> is the <code>tensor</code> type.</td>
  171. </tr>
  172. <tr>
  173. <td><code>template&lt;class derived_type&gt; <br> using matrix_expression_type = matrix_expression&lt;derived_type&gt;</code></td>
  174. <td>Type of <a href= "matrix_expression.html#matrix_expression">matrix_expression</a>.</td>
  175. </tr>
  176. <tr>
  177. <td><code>template&lt;class derived_type&gt; <br> using vector_expression_type = vector_expression&lt;derived_type&gt;</code></td>
  178. <td>Type of <a href= "vector_expression.html#vector_expression">vector_expression</a>.</td>
  179. </tr>
  180. </tbody>
  181. </table>
  182. <h3>Member Functions</h3>
  183. <h4>Construction</h4>
  184. <table border="1" style="font-size:100%" summary="constructors">
  185. <tbody style="font-size:100%" >
  186. <tr>
  187. <th>Member function</th>
  188. <th>Description</th>
  189. </tr>
  190. <tr>
  191. <td><code>tensor ()</code></td>
  192. <td>Constructs an uninitialized <code>tensor</code> that holds zero elements.</td>
  193. </tr>
  194. <tr>
  195. <td><code> tensor (std::initializer_list&lt;size_type&gt; list) </code></td>
  196. <td>Constructs an uninitialized <code>tensor</code> where <code>list</code> specifies the dimension <a href="tensor/extents.html">extents</a>.</td>
  197. </tr>
  198. <tr>
  199. <td><code> tensor (extents_type const& s) </code></td>
  200. <td>Constructs an uninitialized <code>tensor</code> where
  201. <code>s</code> specifies the dimension <a href="tensor/extents.html">extents</a>.</td>
  202. </tr>
  203. <tr>
  204. <td><code> tensor (extents_type const& e, array_type const& a) </code></td>
  205. <td>Constructs an uninitialized <code>tensor</code> where
  206. <code>e</code> specifies the dimension <a href="tensor/extents.html">extents</a> and <code>a</code> the data elements of the tensor.</td>
  207. </tr>
  208. <tr>
  209. <td><code>tensor (tensor&lt;value_type,other_layout&rt; const& other)</code></td>
  210. <td>Constructs tensor by copying elements from <code>other</code> where the layout is different from this layout type.</td>
  211. </tr>
  212. <tr>
  213. <td><code>tensor (tensor const& other)</code></td>
  214. <td>Constructs tensor by copying elements from <code>other</code>.</td>
  215. </tr>
  216. <tr>
  217. <td><code>tensor (tensor && other)</code></td>
  218. <td>Constructs tensor by moving elements from <code>other</code>.</td>
  219. </tr>
  220. <tr>
  221. <td><code>tensor (matrix_type const& other)</code></td>
  222. <td>Constructs tensor by copying elements from <code>other</code> <a href="matrix.html">matrix</a>. The tensor will have the order 2.</td>
  223. </tr>
  224. <tr>
  225. <td><code>tensor (matrix_type && other)</code></td>
  226. <td>Constructs tensor by moving elements from <code>other</code> <a href="matrix.html">matrix</a>. The tensor will have the order 2.</td>
  227. </tr>
  228. <tr>
  229. <td><code>tensor (vector_type const& other)</code></td>
  230. <td>Constructs tensor by copying elements from <code>other</code> <a href="vector.html">vector</a>. The tensor will have the order 1.</td>
  231. </tr>
  232. <tr>
  233. <td><code>tensor (vector_type && other)</code></td>
  234. <td>Constructs tensor by moving elements from <code>other</code> <a href="vector.html">vector</a>. The tensor will have the order 1.</td>
  235. </tr>
  236. <tr>
  237. <td><code>tensor (tensor_expression_type&lt;derived_type&gt; const& expr)</code></td>
  238. <td>Constructs tensor by evaluating the <a href="tensor/tensor_expression.html">tensor expression</a> <code>expr</code> and copying all elements of the result.</td>
  239. </tr>
  240. <tr>
  241. <td><code>tensor (matrix_expression_type&lt;derived_type&gt; const& expr)</code></td>
  242. <td>Constructs tensor by evaluating the <a href="matrix_expression.html">matrix expression</a> <code>expr</code> and copying all elements of the result.</td>
  243. </tr>
  244. <tr>
  245. <td><code>tensor (vector_expression_type&lt;derived_type&gt; const& expr)</code></td>
  246. <td>Constructs tensor by evaluating the <a href="vector_expression.html">vector expression</a> <code>expr</code> and copying all elements of the result.</td>
  247. </tr>
  248. </tbody>
  249. </table>
  250. <!-------------------------------------------->
  251. <h4>Assignment</h4>
  252. <table border="1" style="font-size:100%" summary="constructors">
  253. <tbody style="font-size:100%" >
  254. <tr>
  255. <th>Member function</th>
  256. <th>Description</th>
  257. </tr>
  258. <tr>
  259. <td><code>tensor& operator=(tensor_expression_type&lt;derived_type&gt; const& expr)</code></td>
  260. <td>Evaluates the <a href="tensor/tensor_expression.html">tensor expression</a> <code>expr</code> and copyies all elements of the result.</td>
  261. </tr>
  262. <tr>
  263. <td><code>tensor& operator=(tensor other)</code></td>
  264. <td>Copies or moves elements of <code>other</code>.</td>
  265. </tr>
  266. <tr>
  267. <td><code>tensor& operator=(const_reference v)</code></td>
  268. <td>Initialiates all elements of a tensor with <code>v</code>.</td>
  269. </tr>
  270. </tbody>
  271. </table>
  272. <!-------------------------------------------->
  273. <h4>Capacity</h4>
  274. <table border="1" style="font-size:100%" summary="capacity">
  275. <tbody style="font-size:100%" >
  276. <tr>
  277. <th>Member function</th>
  278. <th>Description</th>
  279. </tr>
  280. <tr>
  281. <td><code>bool empty() const</code></td>
  282. <td>Returns true if a tensor has zero elements.</td>
  283. </tr>
  284. <tr>
  285. <td><code>size_type size() const</code></td>
  286. <td>Returns the number of elements of the tensor.</td>
  287. </tr>
  288. <tr>
  289. <td><code>size_type rank() const</code></td>
  290. <td>Returns the number of dimensions of the tensor.</td>
  291. </tr>
  292. <tr>
  293. <td><code>size_type order() const</code></td>
  294. <td>Returns the number of dimensions of the tensor.</td>
  295. </tr>
  296. <tr>
  297. <td><code>strides_type const& strides() const</code></td>
  298. <td>Returns a constant reference to the <a href="tensor/strides.html">strides</a> of the tensor.</td>
  299. </tr>
  300. <tr>
  301. <td><code>extents_type const& extents() const</code></td>
  302. <td>Returns a constant reference to the <a href="tensor/extents.html">extents</a> of the tensor.</td>
  303. </tr>
  304. </tbody>
  305. </table>
  306. <!-------------------------------------------->
  307. <h4>Element access</h4>
  308. <table border="1" style="font-size:100%" summary="capacity">
  309. <tbody style="font-size:100%" >
  310. <tr>
  311. <th>Member function</th>
  312. <th>Description</th>
  313. </tr>
  314. <tr>
  315. <td><code>pointer data()</code></td>
  316. <td>Returns a <code>pointer</code> the first element of the tensor.</td>
  317. </tr>
  318. <tr>
  319. <td><code>const_pointer data() const</code></td>
  320. <td>Returns a <code>const_pointer</code> the first element of the tensor.</td>
  321. </tr>
  322. <tr>
  323. <td><code>reference operator[](size_type j)</code></td>
  324. <td>Returns a <code>reference</code> to the <code>j</code>-th element of the storage array of the tensor. Corresponds to the function call <code>tensor::data()+j</code></td>
  325. </tr>
  326. <tr>
  327. <td><code>const_reference operator[](size_type j) const</code></td>
  328. <td>Returns a <code>const_reference</code> to the <code>j</code>-th element of the storage array of the tensor. Corresponds to the function call <code>tensor::data()+j</code>.</td>
  329. </tr>
  330. <tr>
  331. <td><code>template&lt;class ... size_types&gt; <br> reference at(size_type i, size_types ... is)</code></td>
  332. <td>Returns a <code>reference</code> to the <code>(i,is...)</code>-th element of the tensor where <code> (i,is...)</code> denotes a multi-index with <code>tensor::order()</code> elements. If <code>sizeof...(is)==0</code>, <code>tensor::operator[i]</code> is called. </td>
  333. </tr>
  334. <tr>
  335. <td><code>template&lt;class ... size_types&gt; <br> const_reference at(size_type i, size_types ... is)</code></td>
  336. <td>Returns a <code>const_reference</code> to the <code>(i,is...)</code>-th element of the tensor where <code> (i,is...)</code> denotes a multi-index with <code>tensor::order()</code> elements. If <code>sizeof...(is)==0</code>, <code>tensor::operator[i]</code> is called. </td>
  337. </tr>
  338. </tbody>
  339. </table>
  340. <!-------------------------------------------->
  341. <h4>Proxy Generation</h4>
  342. <table border="1" style="font-size:100%" summary="capacity">
  343. <tbody style="font-size:100%" >
  344. <tr>
  345. <th>Member function</th>
  346. <th>Description</th>
  347. </tr>
  348. <tr>
  349. <td><code>template&lt;std::size_t I, class ... index_types&gt; <br> tensor_index operator()(indices::Index&lt;I&gt; p, index_types ... ps)</code></td>
  350. <td>Returns a <a href="tensor/tensor_index.html">tensor index</a> instance with index objects <code>(p,ps...)</code> for a tensor contraction where <code>sizeof...(ps)+1</code> must be equal to <code>tensor::order()</code>.</td>
  351. </tr>
  352. </tbody>
  353. </table>
  354. <h4>Iterators</h4>
  355. <table border="1" style="font-size:100%" summary="iterators">
  356. <tbody style="font-size:100%" >
  357. <tr>
  358. <th>Member function</th>
  359. <th>Description</th>
  360. </tr>
  361. <tr>
  362. <td><code>const_iterator begin() const</code></td>
  363. <td>Returns a const_iterator pointing to the first element of the tensor.</td>
  364. </tr>
  365. <tr>
  366. <td><code>const_iterator cbegin() const</code></td>
  367. <td>Returns a const_iterator pointing to the first element of the tensor.</td>
  368. </tr>
  369. <tr>
  370. <td><code>iterator begin()</code></td>
  371. <td>Returns an iterator pointing to the first element of the tensor.</td>
  372. </tr>
  373. <tr>
  374. <td><code>const_iterator end() const</code></td>
  375. <td>Returns a const_iterator pointing to the position after the last element of the tensor.</td>
  376. </tr>
  377. <tr>
  378. <td><code>const_iterator cend() const</code></td>
  379. <td>Returns a const_iterator pointing to the position after the last element of the tensor.</td>
  380. </tr>
  381. <tr>
  382. <td><code>iterator begin()</code></td>
  383. <td>Returns an iterator pointing to the position after the last element of the tensor.</td>
  384. </tr>
  385. </tbody>
  386. </table>
  387. <h4>Modifiers</h4>
  388. <table border="1" style="font-size:100%" summary="modifiers">
  389. <tbody style="font-size:100%" >
  390. <tr>
  391. <th>Member function</th>
  392. <th>Description</th>
  393. </tr>
  394. <tr>
  395. <td><code>void reshape(extents_type const& e, value_type v = value_type{})</code></td>
  396. <td>Reshapes the tensor according to the extents <code>e</code>. If <code>e.product()</code> is greater than <code>tensor::size()</code>, the tensor is resized with <code>v</code>. </td>
  397. </tr>
  398. </tbody>
  399. </table>
  400. <h4>Notes</h4>
  401. <p><a name="tensor_1">[1]</a> Supported parameters
  402. for the storage organization are <code>first_order</code> and
  403. <code>last_order</code>.</p>
  404. <p><a name="tensor_2">[2]</a> Common parameters
  405. for the storage array are <code>std::array&lt;N,T&gt;</code> and
  406. <code>std::vector&lt;T&gt;</code>.</p>
  407. <!-- ----------------------------------------------------
  408. <h2><a name="identity_tensor"></a>Identity Tensor</h2>
  409. <h4>Description</h4>
  410. <p>The templated class <code>identity_tensor&lt;T, ALLOC&gt;</code>
  411. represents identity matrices. For a <em>(m x n</em>)-dimensional
  412. identity tensor and <em>0 &lt;= i &lt; m</em>, <em>0 &lt;= j &lt;
  413. n</em> holds <em>id</em><sub><em>i, j</em></sub> <em>= 0</em>, if
  414. <em>i &lt;&gt; j</em>, and <em>id</em><sub><em>i, i</em></sub><em>=
  415. 1</em>.</p>
  416. <h4>Example</h4>
  417. <pre>
  418. #include &lt;boost/numeric/ublas/tensor.hpp&gt;
  419. #include &lt;boost/numeric/ublas/io.hpp&gt;
  420. int main () {
  421. using namespace boost::numeric::ublas;
  422. identity_tensor&lt;double&gt; m (3);
  423. std::cout &lt;&lt; m &lt;&lt; std::endl;
  424. }
  425. </pre>
  426. <h4>Definition</h4>
  427. <p>Defined in the header tensor.hpp.</p>
  428. <h4>Template parameters</h4>
  429. <table border="1" summary="parameters">
  430. <tbody>
  431. <tr>
  432. <th>Parameter</th>
  433. <th>Description</th>
  434. <th>Default</th>
  435. </tr>
  436. <tr>
  437. <td><code>T</code></td>
  438. <td>The type of object stored in the tensor.</td>
  439. <td><code>int</code></td>
  440. </tr>
  441. <tr>
  442. <td><code>ALLOC</code></td>
  443. <td>An STL Allocator for size_type and difference_type.</td>
  444. <td>std::allocator</td>
  445. </tr>
  446. </tbody>
  447. </table>
  448. <h4>Model of</h4>
  449. <p><a href="container_concept.html#tensor">Tensor</a> .</p>
  450. <h4>Type requirements</h4>
  451. <p>None, except for those imposed by the requirements of
  452. <a href="container_concept.html#tensor">Tensor</a> .</p>
  453. <h4>Public base classes</h4>
  454. <p><code>tensor_container&lt;identity_tensor&lt;T&gt;
  455. &gt;</code></p>
  456. <h4>Members</h4>
  457. <table border="1" summary="members">
  458. <tbody>
  459. <tr>
  460. <th>Member</th>
  461. <th>Description</th>
  462. </tr>
  463. <tr>
  464. <td><code>identity_tensor ()</code></td>
  465. <td>Constructs an <code>identity_tensor</code> that holds zero rows
  466. of zero elements.</td>
  467. </tr>
  468. <tr>
  469. <td><code>identity_tensor (size_type size)</code></td>
  470. <td>Constructs an <code>identity_tensor</code> that holds
  471. <code>size</code> rows of <code>size</code> elements.</td>
  472. </tr>
  473. <tr>
  474. <td><code>identity_tensor (const identity_tensor
  475. &amp;m)</code></td>
  476. <td>The copy constructor.</td>
  477. </tr>
  478. <tr>
  479. <td><code>void resize (size_type size, bool preserve =
  480. true)</code></td>
  481. <td>Resizes a <code>identity_tensor</code> to hold
  482. <code>size</code> rows of <code>size</code> elements. Therefore the
  483. existing elements of the <code>itendity_tensor</code> are always
  484. preseved.</td>
  485. </tr>
  486. <tr>
  487. <td><code>size_type size1 () const</code></td>
  488. <td>Returns the number of rows.</td>
  489. </tr>
  490. <tr>
  491. <td><code>size_type size2 () const</code></td>
  492. <td>Returns the number of columns.</td>
  493. </tr>
  494. <tr>
  495. <td><code>const_reference operator () (size_type i, size_type j)
  496. const</code></td>
  497. <td>Returns the value of the <code>j</code>-th element in the
  498. <code>i</code>-th row.</td>
  499. </tr>
  500. <tr>
  501. <td><code>identity_tensor &amp;operator = (const identity_tensor
  502. &amp;m)</code></td>
  503. <td>The assignment operator.</td>
  504. </tr>
  505. <tr>
  506. <td><code>identity_tensor &amp;assign_temporary (identity_tensor
  507. &amp;m)</code></td>
  508. <td>Assigns a temporary. May change the identity tensor
  509. <code>m</code> .</td>
  510. </tr>
  511. <tr>
  512. <td><code>void swap (identity_tensor &amp;m)</code></td>
  513. <td>Swaps the contents of the identity matrices.</td>
  514. </tr>
  515. <tr>
  516. <td><code>const_iterator1 begin1 () const</code></td>
  517. <td>Returns a <code>const_iterator1</code> pointing to the
  518. beginning of the <code>identity_tensor</code>.</td>
  519. </tr>
  520. <tr>
  521. <td><code>const_iterator1 end1 () const</code></td>
  522. <td>Returns a <code>const_iterator1</code> pointing to the end of
  523. the <code>identity_tensor</code>.</td>
  524. </tr>
  525. <tr>
  526. <td><code>const_iterator2 begin2 () const</code></td>
  527. <td>Returns a <code>const_iterator2</code> pointing to the
  528. beginning of the <code>identity_tensor</code>.</td>
  529. </tr>
  530. <tr>
  531. <td><code>const_iterator2 end2 () const</code></td>
  532. <td>Returns a <code>const_iterator2</code> pointing to the end of
  533. the <code>identity_tensor</code>.</td>
  534. </tr>
  535. <tr>
  536. <td><code>const_reverse_iterator1 rbegin1 () const</code></td>
  537. <td>Returns a <code>const_reverse_iterator1</code> pointing to the
  538. beginning of the reversed <code>identity_tensor</code>.</td>
  539. </tr>
  540. <tr>
  541. <td><code>const_reverse_iterator1 rend1 () const</code></td>
  542. <td>Returns a <code>const_reverse_iterator1</code> pointing to the
  543. end of the reversed <code>identity_tensor</code>.</td>
  544. </tr>
  545. <tr>
  546. <td><code>const_reverse_iterator2 rbegin2 () const</code></td>
  547. <td>Returns a <code>const_reverse_iterator2</code> pointing to the
  548. beginning of the reversed <code>identity_tensor</code>.</td>
  549. </tr>
  550. <tr>
  551. <td><code>const_reverse_iterator2 rend2 () const</code></td>
  552. <td>Returns a <code>const_reverse_iterator2</code> pointing to the
  553. end of the reversed <code>identity_tensor</code>.</td>
  554. </tr>
  555. </tbody>
  556. </table>
  557. ----------------------------------------------------
  558. -->
  559. <hr/>
  560. <p>Copyright (&copy;) 2018 Cem Bassoy<br />
  561. Use, modification and distribution are subject to the
  562. Boost Software License, Version 1.0.
  563. (See accompanying file LICENSE_1_0.txt
  564. or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
  565. http://www.boost.org/LICENSE_1_0.txt
  566. </a>).
  567. </p>
  568. <script type="text/javascript">
  569. (function($) {
  570. $('#toc').toc();
  571. })(jQuery);
  572. </script>
  573. </body>
  574. </html>