root/doc/html/classitpp_1_1Array.html @ 354

Revision 353, 32.7 kB (checked in by smidl, 16 years ago)

doc

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mixpp: itpp::Array&lt; T &gt; Class Template Reference</title>
4<link href="tabs.css" rel="stylesheet" type="text/css">
5<link href="doxygen.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.8 -->
8<script type="text/javascript">
9<!--
10function changeDisplayState (e){
11  var num=this.id.replace(/[^[0-9]/g,'');
12  var button=this.firstChild;
13  var sectionDiv=document.getElementById('dynsection'+num);
14  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
15    sectionDiv.style.display='block';
16    button.src='open.gif';
17  }else{
18    sectionDiv.style.display='none';
19    button.src='closed.gif';
20  }
21}
22function initDynSections(){
23  var divs=document.getElementsByTagName('div');
24  var sectionCounter=1;
25  for(var i=0;i<divs.length-1;i++){
26    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
27      var header=divs[i];
28      var section=divs[i+1];
29      var button=header.firstChild;
30      if (button!='IMG'){
31        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
32        button=document.createElement('img');
33        divs[i].insertBefore(button,divs[i].firstChild);
34      }
35      header.style.cursor='pointer';
36      header.onclick=changeDisplayState;
37      header.id='dynheader'+sectionCounter;
38      button.src='closed.gif';
39      section.id='dynsection'+sectionCounter;
40      section.style.display='none';
41      section.style.marginLeft='14px';
42      sectionCounter++;
43    }
44  }
45}
46window.onload = initDynSections;
47-->
48</script>
49<div class="navigation" id="top">
50  <div class="tabs">
51    <ul>
52      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
53      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
54      <li><a href="modules.html"><span>Modules</span></a></li>
55      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
56      <li><a href="files.html"><span>Files</span></a></li>
57    </ul>
58  </div>
59  <div class="tabs">
60    <ul>
61      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
62      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
63      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
64      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
65    </ul>
66  </div>
67  <div class="navpath"><b>itpp</b>::<a class="el" href="classitpp_1_1Array.html">Array</a>
68  </div>
69</div>
70<div class="contents">
71<h1>itpp::Array&lt; T &gt; Class Template Reference<br>
72<small>
73[<a class="el" href="group__arr__vec__mat.html">Array, Vector and Matrix Classes</a>]</small>
74</h1><!-- doxytag: class="itpp::Array" -->General array class. 
75<a href="#_details">More...</a>
76<p>
77<code>#include &lt;<a class="el" href="array_8h-source.html">array.h</a>&gt;</code>
78<p>
79
80<p>
81<a href="classitpp_1_1Array-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
82<tr><td></td></tr>
83<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
84<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="828caf09fa7e96b0985003276626276c"></a><!-- doxytag: member="itpp::Array::Array" ref="828caf09fa7e96b0985003276626276c" args="(const Factory &amp;f=DEFAULT_FACTORY)" -->
85&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#828caf09fa7e96b0985003276626276c">Array</a> (const <a class="el" href="classitpp_1_1Factory.html">Factory</a> &amp;f=DEFAULT_FACTORY)</td></tr>
86
87<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor. An element factory <code>f</code> can be specified. <br></td></tr>
88<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1bd70bb31b1159af9ed654e9f4a9d67a"></a><!-- doxytag: member="itpp::Array::Array" ref="1bd70bb31b1159af9ed654e9f4a9d67a" args="(int n, const Factory &amp;f=DEFAULT_FACTORY)" -->
89&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#1bd70bb31b1159af9ed654e9f4a9d67a">Array</a> (int n, const <a class="el" href="classitpp_1_1Factory.html">Factory</a> &amp;f=DEFAULT_FACTORY)</td></tr>
90
91<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create an <a class="el" href="classitpp_1_1Array.html" title="General array class.">Array</a> of size <code>n</code>. An element factory <code>f</code> can be specified. <br></td></tr>
92<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4408d1e56c3223975eac1fce4eabcd4a"></a><!-- doxytag: member="itpp::Array::Array" ref="4408d1e56c3223975eac1fce4eabcd4a" args="(const Array&lt; T &gt; &amp;a, const Factory &amp;f=DEFAULT_FACTORY)" -->
93&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#4408d1e56c3223975eac1fce4eabcd4a">Array</a> (const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a, const <a class="el" href="classitpp_1_1Factory.html">Factory</a> &amp;f=DEFAULT_FACTORY)</td></tr>
94
95<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Copy constructor. An element factory <code>f</code> can be specified. <br></td></tr>
96<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d3ab6c8eb0e5ead62180f87f46b35165"></a><!-- doxytag: member="itpp::Array::Array" ref="d3ab6c8eb0e5ead62180f87f46b35165" args="(const std::string &amp;values, const Factory &amp;f=DEFAULT_FACTORY)" -->
97&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#d3ab6c8eb0e5ead62180f87f46b35165">Array</a> (const std::string &amp;values, const <a class="el" href="classitpp_1_1Factory.html">Factory</a> &amp;f=DEFAULT_FACTORY)</td></tr>
98
99<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create an <a class="el" href="classitpp_1_1Array.html" title="General array class.">Array</a> from string. An element factory <code>f</code> can be specified. <br></td></tr>
100<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="883d46ec90a359695b506e1c604c8be5"></a><!-- doxytag: member="itpp::Array::Array" ref="883d46ec90a359695b506e1c604c8be5" args="(const char *values, const Factory &amp;f=DEFAULT_FACTORY)" -->
101&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#883d46ec90a359695b506e1c604c8be5">Array</a> (const char *values, const <a class="el" href="classitpp_1_1Factory.html">Factory</a> &amp;f=DEFAULT_FACTORY)</td></tr>
102
103<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create an <a class="el" href="classitpp_1_1Array.html" title="General array class.">Array</a> from char*. An element factory <code>f</code> can be specified. <br></td></tr>
104<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="843ecbb3d82db87f6944104f485fd4d5"></a><!-- doxytag: member="itpp::Array::~Array" ref="843ecbb3d82db87f6944104f485fd4d5" args="()" -->
105virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#843ecbb3d82db87f6944104f485fd4d5">~Array</a> ()</td></tr>
106
107<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor. <br></td></tr>
108<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c83fc47210a002a55dc70d67baeae32e"></a><!-- doxytag: member="itpp::Array::operator()" ref="c83fc47210a002a55dc70d67baeae32e" args="(int i)" -->
109T &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#c83fc47210a002a55dc70d67baeae32e">operator()</a> (int i)</td></tr>
110
111<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the <code>i</code> element. <br></td></tr>
112<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="86cfb98d4c6f68c6c0e90ce871da2595"></a><!-- doxytag: member="itpp::Array::operator()" ref="86cfb98d4c6f68c6c0e90ce871da2595" args="(int i) const " -->
113const T &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#86cfb98d4c6f68c6c0e90ce871da2595">operator()</a> (int i) const </td></tr>
114
115<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the <code>i</code> element. <br></td></tr>
116<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6dec4bb1ef064de29e1024968c0f2d82"></a><!-- doxytag: member="itpp::Array::operator()" ref="6dec4bb1ef064de29e1024968c0f2d82" args="(int i1, int i2) const " -->
117const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#6dec4bb1ef064de29e1024968c0f2d82">operator()</a> (int i1, int i2) const </td></tr>
118
119<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sub-array from element <code>i1</code> to element <code>i2</code>. <br></td></tr>
120<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a2aecb36ae3c2b5bf6a0d43ab610963a"></a><!-- doxytag: member="itpp::Array::operator()" ref="a2aecb36ae3c2b5bf6a0d43ab610963a" args="(const Array&lt; int &gt; &amp;indices) const " -->
121const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#a2aecb36ae3c2b5bf6a0d43ab610963a">operator()</a> (const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; int &gt; &amp;indices) const </td></tr>
122
123<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sub-array with the elements given by the integer <a class="el" href="classitpp_1_1Array.html" title="General array class.">Array</a>. <br></td></tr>
124<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="8d09b0d22f7c04c48c28f0748e1dedd4"></a><!-- doxytag: member="itpp::Array::left" ref="8d09b0d22f7c04c48c28f0748e1dedd4" args="(int n) const " -->
125<a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#8d09b0d22f7c04c48c28f0748e1dedd4">left</a> (int n) const </td></tr>
126
127<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get <code>n</code> left elements of the array. <br></td></tr>
128<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f538b0bbdd7777574cf0b70031df7eaa"></a><!-- doxytag: member="itpp::Array::right" ref="f538b0bbdd7777574cf0b70031df7eaa" args="(int n) const " -->
129<a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#f538b0bbdd7777574cf0b70031df7eaa">right</a> (int n) const </td></tr>
130
131<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get <code>n</code> right elements of the array. <br></td></tr>
132<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7f210bc941d1e75b6c2f9ab09d05e524"></a><!-- doxytag: member="itpp::Array::mid" ref="7f210bc941d1e75b6c2f9ab09d05e524" args="(int pos, int n) const " -->
133<a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#7f210bc941d1e75b6c2f9ab09d05e524">mid</a> (int pos, int n) const </td></tr>
134
135<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get <code>n</code> elements of the array starting from <code>pos</code>. <br></td></tr>
136<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="670cc48bfb09c05a50af9008650cc735"></a><!-- doxytag: member="itpp::Array::operator=" ref="670cc48bfb09c05a50af9008650cc735" args="(const T &amp;e)" -->
137<a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#670cc48bfb09c05a50af9008650cc735">operator=</a> (const T &amp;e)</td></tr>
138
139<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Assignment operator. <br></td></tr>
140<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="3f6c72d82a1345777c423c336e7c3221"></a><!-- doxytag: member="itpp::Array::operator=" ref="3f6c72d82a1345777c423c336e7c3221" args="(const Array&lt; T &gt; &amp;a)" -->
141<a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#3f6c72d82a1345777c423c336e7c3221">operator=</a> (const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a)</td></tr>
142
143<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Assignment operator. <br></td></tr>
144<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="cec1b549e103508437214f61aede94f2"></a><!-- doxytag: member="itpp::Array::operator=" ref="cec1b549e103508437214f61aede94f2" args="(const char *values)" -->
145<a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#cec1b549e103508437214f61aede94f2">operator=</a> (const char *values)</td></tr>
146
147<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Assignment operator. <br></td></tr>
148<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ce6bb3089de6f3ff86806d78f35505a4"></a><!-- doxytag: member="itpp::Array::size" ref="ce6bb3089de6f3ff86806d78f35505a4" args="() const " -->
149int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#ce6bb3089de6f3ff86806d78f35505a4">size</a> () const </td></tr>
150
151<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of data elements in the array object. <br></td></tr>
152<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="53629018f146084de506c33c69fa19a3"></a><!-- doxytag: member="itpp::Array::length" ref="53629018f146084de506c33c69fa19a3" args="() const " -->
153int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#53629018f146084de506c33c69fa19a3">length</a> () const </td></tr>
154
155<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of data elements in the array object. <br></td></tr>
156<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="dbf76c71f29014a4d53f254e83f3ff1c"></a><!-- doxytag: member="itpp::Array::set_size" ref="dbf76c71f29014a4d53f254e83f3ff1c" args="(int n, bool copy=false)" -->
157void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#dbf76c71f29014a4d53f254e83f3ff1c">set_size</a> (int n, bool copy=false)</td></tr>
158
159<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Resizing an Array&lt;T&gt;. <br></td></tr>
160<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="3709407656d26aae2c5d3e844316d4e0"></a><!-- doxytag: member="itpp::Array::set_length" ref="3709407656d26aae2c5d3e844316d4e0" args="(int n, bool copy=false)" -->
161void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#3709407656d26aae2c5d3e844316d4e0">set_length</a> (int n, bool copy=false)</td></tr>
162
163<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Resizing an Array&lt;T&gt;. <br></td></tr>
164<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="953e9c8e8e5d3d8777bccb99c0c2ef03"></a><!-- doxytag: member="itpp::Array::shift_right" ref="953e9c8e8e5d3d8777bccb99c0c2ef03" args="(const T &amp;e)" -->
165T&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#953e9c8e8e5d3d8777bccb99c0c2ef03">shift_right</a> (const T &amp;e)</td></tr>
166
167<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Shift in data at position 0. Return data from the last position. <br></td></tr>
168<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="95c7113be8ffdb98b84471cef02f6e75"></a><!-- doxytag: member="itpp::Array::shift_right" ref="95c7113be8ffdb98b84471cef02f6e75" args="(const Array&lt; T &gt; &amp;a)" -->
169const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#95c7113be8ffdb98b84471cef02f6e75">shift_right</a> (const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a)</td></tr>
170
171<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Shift in array at position 0. Return data from the last position. <br></td></tr>
172<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="82c1fc430eeef2fe5664ad68fb80f465"></a><!-- doxytag: member="itpp::Array::shift_left" ref="82c1fc430eeef2fe5664ad68fb80f465" args="(const T &amp;e)" -->
173T&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#82c1fc430eeef2fe5664ad68fb80f465">shift_left</a> (const T &amp;e)</td></tr>
174
175<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Shift in data at the last position. Return data from position 0. <br></td></tr>
176<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b5809a4bf63a413563799ea11584bff8"></a><!-- doxytag: member="itpp::Array::shift_left" ref="b5809a4bf63a413563799ea11584bff8" args="(const Array&lt; T &gt; &amp;a)" -->
177const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#b5809a4bf63a413563799ea11584bff8">shift_left</a> (const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a)</td></tr>
178
179<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Shift in array at the last position. Return data from position 0. <br></td></tr>
180<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="68c427966b7a5ffc25ff92f5ab1e8188"></a><!-- doxytag: member="itpp::Array::swap" ref="68c427966b7a5ffc25ff92f5ab1e8188" args="(int i, int j)" -->
181void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#68c427966b7a5ffc25ff92f5ab1e8188">swap</a> (int i, int j)</td></tr>
182
183<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Swap elements i and j. <br></td></tr>
184<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="77c84914c6c73bab1720300a3c37a700"></a><!-- doxytag: member="itpp::Array::set_subarray" ref="77c84914c6c73bab1720300a3c37a700" args="(int i1, int i2, const Array&lt; T &gt; &amp;a)" -->
185void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#77c84914c6c73bab1720300a3c37a700">set_subarray</a> (int i1, int i2, const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a)</td></tr>
186
187<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the subarray defined by indicies i1 to i2 to Array&lt;T&gt; a. <br></td></tr>
188<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="fb9d105beea055bac5d5b5bcce2a41fd"></a><!-- doxytag: member="itpp::Array::set_subarray" ref="fb9d105beea055bac5d5b5bcce2a41fd" args="(int i1, int i2, const T t)" -->
189void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#fb9d105beea055bac5d5b5bcce2a41fd">set_subarray</a> (int i1, int i2, const T t)</td></tr>
190
191<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the subarray defined by indicies i1 to i2 the element value t. <br></td></tr>
192<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
193<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="11d3a25f034298549ecd36f2d997f303"></a><!-- doxytag: member="itpp::Array::alloc" ref="11d3a25f034298549ecd36f2d997f303" args="(int n)" -->
194void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#11d3a25f034298549ecd36f2d997f303">alloc</a> (int n)</td></tr>
195
196<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocate storage for an array of length <code>n</code>. <br></td></tr>
197<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2f37242e1fadb8a011a11079eb0b28ed"></a><!-- doxytag: member="itpp::Array::free" ref="2f37242e1fadb8a011a11079eb0b28ed" args="()" -->
198void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#2f37242e1fadb8a011a11079eb0b28ed">free</a> ()</td></tr>
199
200<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Free the storage space allocated by the array. <br></td></tr>
201<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ff5bfdc700d2e218d585c1d82ec5035e"></a><!-- doxytag: member="itpp::Array::in_range" ref="ff5bfdc700d2e218d585c1d82ec5035e" args="(int i) const " -->
202bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#ff5bfdc700d2e218d585c1d82ec5035e">in_range</a> (int i) const </td></tr>
203
204<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check whether index <code>i</code> is in the allowed range. <br></td></tr>
205<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
206<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="5ed232605de7519ec8a7cd18ef33ea6a"></a><!-- doxytag: member="itpp::Array::ndata" ref="5ed232605de7519ec8a7cd18ef33ea6a" args="" -->
207int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#5ed232605de7519ec8a7cd18ef33ea6a">ndata</a></td></tr>
208
209<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The current number of elements in the <a class="el" href="classitpp_1_1Array.html" title="General array class.">Array</a>. <br></td></tr>
210<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d6ae1c2800467bc2a5895b70f1c76cf6"></a><!-- doxytag: member="itpp::Array::data" ref="d6ae1c2800467bc2a5895b70f1c76cf6" args="" -->
211T *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#d6ae1c2800467bc2a5895b70f1c76cf6">data</a></td></tr>
212
213<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">A pointer to the data area. <br></td></tr>
214<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="79db0620d6f2512da65847033810e2b1"></a><!-- doxytag: member="itpp::Array::factory" ref="79db0620d6f2512da65847033810e2b1" args="" -->
215const <a class="el" href="classitpp_1_1Factory.html">Factory</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#79db0620d6f2512da65847033810e2b1">factory</a></td></tr>
216
217<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Element factory (by default set to DEFAULT_FACTORY). <br></td></tr>
218<tr><td colspan="2"><br><h2>Friends</h2></td></tr>
219<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e0cad766aa0d06a83ce2e1d5f22b22eb"></a><!-- doxytag: member="itpp::Array::concat" ref="e0cad766aa0d06a83ce2e1d5f22b22eb" args="(const Array&lt; T &gt; &amp;a1, const T e)" -->
220const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#e0cad766aa0d06a83ce2e1d5f22b22eb">concat</a> (const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a1, const T e)</td></tr>
221
222<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Append element <code>e</code> to the end of the <a class="el" href="classitpp_1_1Array.html" title="General array class.">Array</a> <code>a</code>. <br></td></tr>
223<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ef2f769beff7c0e855debc43118011ea"></a><!-- doxytag: member="itpp::Array::concat" ref="ef2f769beff7c0e855debc43118011ea" args="(const T e, const Array&lt; T &gt; &amp;a)" -->
224const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#ef2f769beff7c0e855debc43118011ea">concat</a> (const T e, const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a)</td></tr>
225
226<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Concat element <code>e</code> to the beginning of the <a class="el" href="classitpp_1_1Array.html" title="General array class.">Array</a> <code>a</code>. <br></td></tr>
227<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d776328f4fd6ce9f21a34b67752ac585"></a><!-- doxytag: member="itpp::Array::concat" ref="d776328f4fd6ce9f21a34b67752ac585" args="(const Array&lt; T &gt; &amp;a1, const Array&lt; T &gt; &amp;a2)" -->
228const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#d776328f4fd6ce9f21a34b67752ac585">concat</a> (const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a1, const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a2)</td></tr>
229
230<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Concat Arrays <code>a1</code> and <code>a2</code>. <br></td></tr>
231<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="95cfc35fcd4c5ea9cf9465ada135a3be"></a><!-- doxytag: member="itpp::Array::concat" ref="95cfc35fcd4c5ea9cf9465ada135a3be" args="(const Array&lt; T &gt; &amp;a1, const Array&lt; T &gt; &amp;a2, const Array&lt; T &gt; &amp;a3)" -->
232const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#95cfc35fcd4c5ea9cf9465ada135a3be">concat</a> (const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a1, const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a2, const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a3)</td></tr>
233
234<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Concat Arrays <code>a1</code>, <code>a2</code> and <code>a3</code>. <br></td></tr>
235<tr><td colspan="2"><br><h2>Related Functions</h2></td></tr>
236<tr><td colspan="2">(Note that these are not member functions.) <br><br></td></tr>
237<tr><td class="memTemplParams" nowrap colspan="2"><a class="anchor" name="527a6c86b076ffe554452697e19b8f60"></a><!-- doxytag: member="itpp::Array::operator&lt;&lt;" ref="527a6c86b076ffe554452697e19b8f60" args="(std::ostream &amp;os, const Array&lt; T &gt; &amp;a)" -->
238template&lt;class T &gt; </td></tr>
239<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">std::ostream &amp;&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#527a6c86b076ffe554452697e19b8f60">operator&lt;&lt;</a> (std::ostream &amp;os, const <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a)</td></tr>
240
241<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Output stream for Array&lt;T&gt;. T must have ostream operator&lt;&lt; defined. <br></td></tr>
242<tr><td class="memTemplParams" nowrap colspan="2"><a class="anchor" name="fe07b04bfe22532f04c5584abd66de56"></a><!-- doxytag: member="itpp::Array::operator&gt;&gt;" ref="fe07b04bfe22532f04c5584abd66de56" args="(std::istream &amp;is, Array&lt; T &gt; &amp;a)" -->
243template&lt;class T &gt; </td></tr>
244<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">std::istream &amp;&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#fe07b04bfe22532f04c5584abd66de56">operator&gt;&gt;</a> (std::istream &amp;is, <a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a)</td></tr>
245
246<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Input stream for Array&lt;T&gt;. T must have istream operator&gt;&gt; defined. <br></td></tr>
247<tr><td class="memTemplParams" nowrap colspan="2"><a class="anchor" name="67cb651aaaef00b3ee8f642e1c644542"></a><!-- doxytag: member="itpp::Array::set_array" ref="67cb651aaaef00b3ee8f642e1c644542" args="(Array&lt; T &gt; &amp;a, const char *values)" -->
248template&lt;class T &gt; </td></tr>
249<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#67cb651aaaef00b3ee8f642e1c644542">set_array</a> (<a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a, const char *values)</td></tr>
250
251<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Assign a C-style string to an Array&lt;T&gt;. T must have istream operator&gt;&gt; defined. <br></td></tr>
252<tr><td class="memTemplParams" nowrap colspan="2"><a class="anchor" name="c86e8aff5f332b77c8ffe680b56ddcf9"></a><!-- doxytag: member="itpp::Array::set_array" ref="c86e8aff5f332b77c8ffe680b56ddcf9" args="(Array&lt; T &gt; &amp;a, const std::string &amp;str)" -->
253template&lt;class T &gt; </td></tr>
254<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classitpp_1_1Array.html#c86e8aff5f332b77c8ffe680b56ddcf9">set_array</a> (<a class="el" href="classitpp_1_1Array.html">Array</a>&lt; T &gt; &amp;a, const std::string &amp;str)</td></tr>
255
256<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Assign a string to an Array&lt;T&gt;. T must have istream operator&gt;&gt; defined. <br></td></tr>
257</table>
258<hr><a name="_details"></a><h2>Detailed Description</h2>
259<h3>template&lt;class T&gt;<br>
260 class itpp::Array&lt; T &gt;</h3>
261
262General array class.
263<p>
264<dl class="author" compact><dt><b>Author:</b></dt><dd>Tobias Ringstrom and Adam Piatyszek</dd></dl>
265This class is a general linear array class for arbitrary types. The operations and functions are the same as for the vector <code><a class="el" href="classitpp_1_1Vec.html" title="Vector Class (Templated).">Vec</a></code> class (except for the arithmetics).<p>
266For rarely used types you will need to instantiate the class by <div class="fragment"><pre class="fragment">  <span class="keyword">template</span> <span class="keyword">class </span>Array&lt;type&gt;;
267</pre></div><p>
268The following example shows how to define an <a class="el" href="classitpp_1_1Array.html" title="General array class.">Array</a> of vectors: <div class="fragment"><pre class="fragment">  vec a = <a class="code" href="group__randgen.html#g9ecf5af23567f51abc9af737fdbd872a" title="Generates a random Gaussian (0,1) variable.">randn</a>(10);
269  vec b = <a class="code" href="group__randgen.html#g9ecf5af23567f51abc9af737fdbd872a" title="Generates a random Gaussian (0,1) variable.">randn</a>(20);
270  vec c = <a class="code" href="group__randgen.html#g9ecf5af23567f51abc9af737fdbd872a" title="Generates a random Gaussian (0,1) variable.">randn</a>(30);
271  Array&lt;vec&gt; my_array(3);
272  my_array(0) = a;
273  my_array(1) = b;
274  my_array(2) = c;
275</pre></div><p>
276For types T with istream <code>operator&gt;&gt;</code> defined special constructor or <code>operator=</code> or <code>set_array</code> functions (see Related Functions) can be used to assign a string literal to an <a class="el" href="classitpp_1_1Array.html" title="General array class.">Array</a>. The string literal has the same format that is used by the istream/ostream operators:<p>
277<div class="fragment"><pre class="fragment">  <span class="comment">// Initialise an array with three bit vectors</span>
278  Array&lt;bvec&gt; B = <span class="stringliteral">"{[1 0 1] [0 0 1] [1 0 0 0 1]}"</span>;
279
280  <span class="comment">// Declare an Array of Arrays of vectors</span>
281  Array&lt;Array&lt;ivec&gt; &gt; an_array;
282
283  <span class="comment">// Assign with an Array containing 2 Arrays,</span>
284  <span class="comment">// the first Array containing [1 2] and</span>
285  <span class="comment">// the second Array containing [3 4 5] and [6 7]</span>
286  <a class="code" href="classitpp_1_1Array.html#67cb651aaaef00b3ee8f642e1c644542" title="Assign a C-style string to an Array&amp;lt;T&amp;gt;. T must have istream operator&amp;gt;&amp;gt;...">set_array</a>(an_array, <span class="stringliteral">"{{[1 2]} {[3 4 5] [6 7]}}"</span>);
287</pre></div><p>
288By default, <a class="el" href="classitpp_1_1Array.html" title="General array class.">Array</a> elements are created using the default constructor for the element type. This can be changed by specifying a suitable <a class="el" href="classitpp_1_1Factory.html" title="Base class for class factories.">Factory</a> in the <a class="el" href="classitpp_1_1Array.html" title="General array class.">Array</a> constructor call (see Detailed Description for <a class="el" href="classitpp_1_1Factory.html" title="Base class for class factories.">Factory</a>). <hr>The documentation for this class was generated from the following file:<ul>
289<li><a class="el" href="array_8h-source.html">array.h</a></ul>
290</div>
291<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:18 2009 for mixpp by&nbsp;
292<a href="http://www.doxygen.org/index.html">
293<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
294</body>
295</html>
Note: See TracBrowser for help on using the browser.