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::Sparse_Vec< T > 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 | <!-- |
---|
10 | function 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 | } |
---|
22 | function 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 | } |
---|
46 | window.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 Page</span></a></li> |
---|
53 | <li><a href="pages.html"><span>Related 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 List</span></a></li> |
---|
62 | <li><a href="classes.html"><span>Class Index</span></a></li> |
---|
63 | <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> |
---|
64 | <li><a href="functions.html"><span>Class Members</span></a></li> |
---|
65 | </ul> |
---|
66 | </div> |
---|
67 | <div class="navpath"><b>itpp</b>::<a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a> |
---|
68 | </div> |
---|
69 | </div> |
---|
70 | <div class="contents"> |
---|
71 | <h1>itpp::Sparse_Vec< T > Class Template Reference</h1><!-- doxytag: class="itpp::Sparse_Vec" -->Templated sparse vector class. |
---|
72 | <a href="#_details">More...</a> |
---|
73 | <p> |
---|
74 | <code>#include <<a class="el" href="svec_8h-source.html">svec.h</a>></code> |
---|
75 | <p> |
---|
76 | |
---|
77 | <p> |
---|
78 | <a href="classitpp_1_1Sparse__Vec-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0"> |
---|
79 | <tr><td></td></tr> |
---|
80 | <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> |
---|
81 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="39fcb7d641a1b6c022e7413041e00f0a"></a><!-- doxytag: member="itpp::Sparse_Vec::Sparse_Vec" ref="39fcb7d641a1b6c022e7413041e00f0a" args="()" --> |
---|
82 | </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#39fcb7d641a1b6c022e7413041e00f0a">Sparse_Vec</a> ()</td></tr> |
---|
83 | |
---|
84 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <br></td></tr> |
---|
85 | <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#a0abee3a9c045d3093fb1becc3a4be32">Sparse_Vec</a> (int sz, int data_init=200)</td></tr> |
---|
86 | |
---|
87 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Initiate an empty sparse vector. <a href="#a0abee3a9c045d3093fb1becc3a4be32"></a><br></td></tr> |
---|
88 | <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#9fd90c90b73ec0d6a92a641f3c7dcc23">Sparse_Vec</a> (const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v)</td></tr> |
---|
89 | |
---|
90 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Initiate a new sparse vector. <a href="#9fd90c90b73ec0d6a92a641f3c7dcc23"></a><br></td></tr> |
---|
91 | <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#cafcd2a02b1c37ffb519b02afcff2e25">Sparse_Vec</a> (const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v)</td></tr> |
---|
92 | |
---|
93 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Initiate a new sparse vector from a dense vector. <a href="#cafcd2a02b1c37ffb519b02afcff2e25"></a><br></td></tr> |
---|
94 | <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#11808d0c9a62f8a68707567efe82e19f">Sparse_Vec</a> (const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v, T epsilon)</td></tr> |
---|
95 | |
---|
96 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Initiate a new sparse vector from a dense vector. Elements of <code>v</code> larger than <code>epsilon</code> are copied into the new sparse vector. <a href="#11808d0c9a62f8a68707567efe82e19f"></a><br></td></tr> |
---|
97 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="91654f6ae8be75ca792f8e6aea4195fc"></a><!-- doxytag: member="itpp::Sparse_Vec::~Sparse_Vec" ref="91654f6ae8be75ca792f8e6aea4195fc" args="()" --> |
---|
98 | </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#91654f6ae8be75ca792f8e6aea4195fc">~Sparse_Vec</a> ()</td></tr> |
---|
99 | |
---|
100 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <br></td></tr> |
---|
101 | <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#1f542b437bdf9942b3f386ccc6e53577">set_size</a> (int sz, int data_init=-1)</td></tr> |
---|
102 | |
---|
103 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the size <code>sz</code> of the sparse vector. Default value <code>data_init=-1</code> <code>=></code> allocated size for the data is not changed. <a href="#1f542b437bdf9942b3f386ccc6e53577"></a><br></td></tr> |
---|
104 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="86a41d34d1d5a1dbfe778b6fe21bf98e"></a><!-- doxytag: member="itpp::Sparse_Vec::size" ref="86a41d34d1d5a1dbfe778b6fe21bf98e" args="() const " --> |
---|
105 | int </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#86a41d34d1d5a1dbfe778b6fe21bf98e">size</a> () const </td></tr> |
---|
106 | |
---|
107 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the size of the sparse vector. <br></td></tr> |
---|
108 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="574eb67974100fb492067c16216dbefc"></a><!-- doxytag: member="itpp::Sparse_Vec::nnz" ref="574eb67974100fb492067c16216dbefc" args="()" --> |
---|
109 | int </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#574eb67974100fb492067c16216dbefc">nnz</a> ()</td></tr> |
---|
110 | |
---|
111 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Number of non-zero elements in the sparse vector. <br></td></tr> |
---|
112 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9dcac972a88c8e86eb2b32794db4ab1a"></a><!-- doxytag: member="itpp::Sparse_Vec::density" ref="9dcac972a88c8e86eb2b32794db4ab1a" args="()" --> |
---|
113 | double </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#9dcac972a88c8e86eb2b32794db4ab1a">density</a> ()</td></tr> |
---|
114 | |
---|
115 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the density of the sparse vector: (number of non-zero elements)/(size of the vector). <br></td></tr> |
---|
116 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6f2ddfff6c73bf4afb024cb6502960ae"></a><!-- doxytag: member="itpp::Sparse_Vec::set_small_element" ref="6f2ddfff6c73bf4afb024cb6502960ae" args="(const T &epsilon)" --> |
---|
117 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#6f2ddfff6c73bf4afb024cb6502960ae">set_small_element</a> (const T &epsilon)</td></tr> |
---|
118 | |
---|
119 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set that all elements smaller than <em>epsilon</em> should be set to zero. <br></td></tr> |
---|
120 | <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#f4a70276d329e74da185b4b331fbcfa6">remove_small_elements</a> ()</td></tr> |
---|
121 | |
---|
122 | <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#e13e88712aafec410acce936dc708073">resize_data</a> (int new_size)</td></tr> |
---|
123 | |
---|
124 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the maximum number of non-zero elements to <code>new_size</code>. <a href="#e13e88712aafec410acce936dc708073"></a><br></td></tr> |
---|
125 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="eecd9a99a1aef11b939ef9a5a329ee6e"></a><!-- doxytag: member="itpp::Sparse_Vec::compact" ref="eecd9a99a1aef11b939ef9a5a329ee6e" args="()" --> |
---|
126 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#eecd9a99a1aef11b939ef9a5a329ee6e">compact</a> ()</td></tr> |
---|
127 | |
---|
128 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the maximum number of non-zero elements equal to the actual number of non-zero elements. <br></td></tr> |
---|
129 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="abb60df924a9f3ad266c24c4da4787ed"></a><!-- doxytag: member="itpp::Sparse_Vec::full" ref="abb60df924a9f3ad266c24c4da4787ed" args="(Vec< T > &v) const " --> |
---|
130 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#abb60df924a9f3ad266c24c4da4787ed">full</a> (<a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v) const </td></tr> |
---|
131 | |
---|
132 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns a full, dense vector in <code>v</code>. <br></td></tr> |
---|
133 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="8918eae0c5c39b224912a6d3296a160f"></a><!-- doxytag: member="itpp::Sparse_Vec::full" ref="8918eae0c5c39b224912a6d3296a160f" args="() const " --> |
---|
134 | <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#8918eae0c5c39b224912a6d3296a160f">full</a> () const </td></tr> |
---|
135 | |
---|
136 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns a full, dense vector. <br></td></tr> |
---|
137 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7e9b425456f1df975b156eae385dc1f6"></a><!-- doxytag: member="itpp::Sparse_Vec::operator()" ref="7e9b425456f1df975b156eae385dc1f6" args="(int i) const " --> |
---|
138 | T </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#7e9b425456f1df975b156eae385dc1f6">operator()</a> (int i) const </td></tr> |
---|
139 | |
---|
140 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the element with index <code>i</code>. <br></td></tr> |
---|
141 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="080a7186e61140cdc739201bfcb60934"></a><!-- doxytag: member="itpp::Sparse_Vec::set" ref="080a7186e61140cdc739201bfcb60934" args="(int i, T v)" --> |
---|
142 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#080a7186e61140cdc739201bfcb60934">set</a> (int i, T v)</td></tr> |
---|
143 | |
---|
144 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set element <code>i</code> equal to <code>v</code>. <br></td></tr> |
---|
145 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ee53f9ab6cbc6ee2553c62b6ed66e196"></a><!-- doxytag: member="itpp::Sparse_Vec::set" ref="ee53f9ab6cbc6ee2553c62b6ed66e196" args="(const ivec &index_vec, const Vec< T > &v)" --> |
---|
146 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#ee53f9ab6cbc6ee2553c62b6ed66e196">set</a> (const ivec &index_vec, const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v)</td></tr> |
---|
147 | |
---|
148 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the elements of the sparse vector with indices <code>index_vec</code> to the values in <code>v</code>. <br></td></tr> |
---|
149 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="55adfb73da94ec8e567270d344d17555"></a><!-- doxytag: member="itpp::Sparse_Vec::set_new" ref="55adfb73da94ec8e567270d344d17555" args="(int i, T v)" --> |
---|
150 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#55adfb73da94ec8e567270d344d17555">set_new</a> (int i, T v)</td></tr> |
---|
151 | |
---|
152 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set a new element with index <code>i</code> equal to <code>v</code>. <br></td></tr> |
---|
153 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="bd8056f722ef6c262a11201d15e9e008"></a><!-- doxytag: member="itpp::Sparse_Vec::set_new" ref="bd8056f722ef6c262a11201d15e9e008" args="(const ivec &index_vec, const Vec< T > &v)" --> |
---|
154 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#bd8056f722ef6c262a11201d15e9e008">set_new</a> (const ivec &index_vec, const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v)</td></tr> |
---|
155 | |
---|
156 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set new elements with indices <code>index_vec</code> equal to the values in <code>v</code> (no check whether the same index is used several times). <br></td></tr> |
---|
157 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="63b4e493346887db93f25b40f7352b91"></a><!-- doxytag: member="itpp::Sparse_Vec::add_elem" ref="63b4e493346887db93f25b40f7352b91" args="(const int i, const T v)" --> |
---|
158 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#63b4e493346887db93f25b40f7352b91">add_elem</a> (const int i, const T v)</td></tr> |
---|
159 | |
---|
160 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Add element <code>i</code> with <code>v</code>. <br></td></tr> |
---|
161 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9f3ef93cf84c3fc402e9303ff9fced8e"></a><!-- doxytag: member="itpp::Sparse_Vec::add" ref="9f3ef93cf84c3fc402e9303ff9fced8e" args="(const ivec &index_vec, const Vec< T > &v)" --> |
---|
162 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#9f3ef93cf84c3fc402e9303ff9fced8e">add</a> (const ivec &index_vec, const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v)</td></tr> |
---|
163 | |
---|
164 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Add <code>v</code> to the elements specified by <code>index_vec</code> with <code>v</code>. <br></td></tr> |
---|
165 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="259ac11b4eec8a9b76d14777edcdf941"></a><!-- doxytag: member="itpp::Sparse_Vec::zeros" ref="259ac11b4eec8a9b76d14777edcdf941" args="()" --> |
---|
166 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#259ac11b4eec8a9b76d14777edcdf941">zeros</a> ()</td></tr> |
---|
167 | |
---|
168 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the sparse vector to the all zero vector (removes all non-zero elements). <br></td></tr> |
---|
169 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7f28c432a7166b661834b6ddfa0aefc4"></a><!-- doxytag: member="itpp::Sparse_Vec::zero_elem" ref="7f28c432a7166b661834b6ddfa0aefc4" args="(const int i)" --> |
---|
170 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#7f28c432a7166b661834b6ddfa0aefc4">zero_elem</a> (const int i)</td></tr> |
---|
171 | |
---|
172 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Set the i-th element to zero (i.e. clear that element if it contains a non-zero value). <br></td></tr> |
---|
173 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e48f0bf68cfa0d2c8700952585e0c8eb"></a><!-- doxytag: member="itpp::Sparse_Vec::clear" ref="e48f0bf68cfa0d2c8700952585e0c8eb" args="()" --> |
---|
174 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#e48f0bf68cfa0d2c8700952585e0c8eb">clear</a> ()</td></tr> |
---|
175 | |
---|
176 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Clear all non-zero elements of the sparse vector. <br></td></tr> |
---|
177 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7e9f5693f6b709ddf7367b7e4b846f07"></a><!-- doxytag: member="itpp::Sparse_Vec::clear_elem" ref="7e9f5693f6b709ddf7367b7e4b846f07" args="(const int i)" --> |
---|
178 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#7e9f5693f6b709ddf7367b7e4b846f07">clear_elem</a> (const int i)</td></tr> |
---|
179 | |
---|
180 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Clear the i-th element (if it contains a non-zero value). <br></td></tr> |
---|
181 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="992d661ff475547dde7167b11a2623df"></a><!-- doxytag: member="itpp::Sparse_Vec::get_nz_data" ref="992d661ff475547dde7167b11a2623df" args="(int p, T &data_out)" --> |
---|
182 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#992d661ff475547dde7167b11a2623df">get_nz_data</a> (int p, T &data_out)</td></tr> |
---|
183 | |
---|
184 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Extract the reference to the p-th non-zero data element. <br></td></tr> |
---|
185 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="48b6acd9fe36985f92b8746be784f2ec"></a><!-- doxytag: member="itpp::Sparse_Vec::get_nz_data" ref="48b6acd9fe36985f92b8746be784f2ec" args="(int p)" --> |
---|
186 | T </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#48b6acd9fe36985f92b8746be784f2ec">get_nz_data</a> (int p)</td></tr> |
---|
187 | |
---|
188 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the p-th non-zero data element. <br></td></tr> |
---|
189 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a86f06c01f042925d6b8005b26bd6b0b"></a><!-- doxytag: member="itpp::Sparse_Vec::get_nz_index" ref="a86f06c01f042925d6b8005b26bd6b0b" args="(int p)" --> |
---|
190 | int </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#a86f06c01f042925d6b8005b26bd6b0b">get_nz_index</a> (int p)</td></tr> |
---|
191 | |
---|
192 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the vector index of the p-th non-zero element. <br></td></tr> |
---|
193 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="bc9847c443a80c136306daeca1fdc3bf"></a><!-- doxytag: member="itpp::Sparse_Vec::get_nz" ref="bc9847c443a80c136306daeca1fdc3bf" args="(int p, int &idx, T &dat)" --> |
---|
194 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#bc9847c443a80c136306daeca1fdc3bf">get_nz</a> (int p, int &idx, T &dat)</td></tr> |
---|
195 | |
---|
196 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the p-th non-zero value in <code>dat</code> and the corresponding vector index in <code>idx</code>. <br></td></tr> |
---|
197 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="52046b9bcd75e1fda1d745e9dbc4f8e7"></a><!-- doxytag: member="itpp::Sparse_Vec::get_nz_indices" ref="52046b9bcd75e1fda1d745e9dbc4f8e7" args="()" --> |
---|
198 | ivec </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#52046b9bcd75e1fda1d745e9dbc4f8e7">get_nz_indices</a> ()</td></tr> |
---|
199 | |
---|
200 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Return the indices of non-zero values. <br></td></tr> |
---|
201 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4d5f4ce3ee456b4623b995df6bbe19b5"></a><!-- doxytag: member="itpp::Sparse_Vec::get_subvector" ref="4d5f4ce3ee456b4623b995df6bbe19b5" args="(int i1, int i2) const " --> |
---|
202 | <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#4d5f4ce3ee456b4623b995df6bbe19b5">get_subvector</a> (int i1, int i2) const </td></tr> |
---|
203 | |
---|
204 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Return sparse subvector from index <code>i1</code> to index <code>i2</code>. <br></td></tr> |
---|
205 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e3dbd58f2a416f2cf9b515e8e91fc95b"></a><!-- doxytag: member="itpp::Sparse_Vec::sqr" ref="e3dbd58f2a416f2cf9b515e8e91fc95b" args="() const " --> |
---|
206 | T </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#e3dbd58f2a416f2cf9b515e8e91fc95b">sqr</a> () const </td></tr> |
---|
207 | |
---|
208 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the sum of all values squared. <br></td></tr> |
---|
209 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c4ef932d3ed56cba68c8b0ecb7ba278b"></a><!-- doxytag: member="itpp::Sparse_Vec::operator=" ref="c4ef932d3ed56cba68c8b0ecb7ba278b" args="(const Sparse_Vec< T > &v)" --> |
---|
210 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#c4ef932d3ed56cba68c8b0ecb7ba278b">operator=</a> (const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v)</td></tr> |
---|
211 | |
---|
212 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Assign sparse vector the value and length of the sparse vector <code>v</code>. <br></td></tr> |
---|
213 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f434c0f6790150b767bf8d6275318360"></a><!-- doxytag: member="itpp::Sparse_Vec::operator=" ref="f434c0f6790150b767bf8d6275318360" args="(const Vec< T > &v)" --> |
---|
214 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#f434c0f6790150b767bf8d6275318360">operator=</a> (const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v)</td></tr> |
---|
215 | |
---|
216 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Assign sparse vector the value and length of the dense vector <code>v</code>. <br></td></tr> |
---|
217 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="db64167ef8f7b46cc6a8b3f2d72a549f"></a><!-- doxytag: member="itpp::Sparse_Vec::operator-" ref="db64167ef8f7b46cc6a8b3f2d72a549f" args="() const " --> |
---|
218 | <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#db64167ef8f7b46cc6a8b3f2d72a549f">operator-</a> () const </td></tr> |
---|
219 | |
---|
220 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the sign inverse of all elements in the sparse vector. <br></td></tr> |
---|
221 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4a2d2a7bea045243c796d91cfb390a13"></a><!-- doxytag: member="itpp::Sparse_Vec::operator==" ref="4a2d2a7bea045243c796d91cfb390a13" args="(const Sparse_Vec< T > &v)" --> |
---|
222 | bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#4a2d2a7bea045243c796d91cfb390a13">operator==</a> (const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v)</td></tr> |
---|
223 | |
---|
224 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Compare two sparse vectors. False if wrong sizes or different values. <br></td></tr> |
---|
225 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f801cdfc077c286c2fb4079239ac11d1"></a><!-- doxytag: member="itpp::Sparse_Vec::operator+=" ref="f801cdfc077c286c2fb4079239ac11d1" args="(const Sparse_Vec< T > &v)" --> |
---|
226 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#f801cdfc077c286c2fb4079239ac11d1">operator+=</a> (const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v)</td></tr> |
---|
227 | |
---|
228 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Add sparse vector <code>v</code> to all non-zero elements of the sparse vector. <br></td></tr> |
---|
229 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ae52eecb5781b416b48d213a9316b399"></a><!-- doxytag: member="itpp::Sparse_Vec::operator+=" ref="ae52eecb5781b416b48d213a9316b399" args="(const Vec< T > &v)" --> |
---|
230 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#ae52eecb5781b416b48d213a9316b399">operator+=</a> (const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v)</td></tr> |
---|
231 | |
---|
232 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Add vector <code>v</code> to all non-zero elements of the sparse vector. <br></td></tr> |
---|
233 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6e6425041822cfa30871bae71ede7df4"></a><!-- doxytag: member="itpp::Sparse_Vec::operator-=" ref="6e6425041822cfa30871bae71ede7df4" args="(const Sparse_Vec< T > &v)" --> |
---|
234 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#6e6425041822cfa30871bae71ede7df4">operator-=</a> (const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v)</td></tr> |
---|
235 | |
---|
236 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Subtract sparse vector <code>v</code> from all non-zero elements of the sparse vector. <br></td></tr> |
---|
237 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1144cbcd69b62d3934e8142ad8df7471"></a><!-- doxytag: member="itpp::Sparse_Vec::operator-=" ref="1144cbcd69b62d3934e8142ad8df7471" args="(const Vec< T > &v)" --> |
---|
238 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#1144cbcd69b62d3934e8142ad8df7471">operator-=</a> (const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v)</td></tr> |
---|
239 | |
---|
240 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Subtract vector <code>v</code> from all non-zero elements of the sparse vector. <br></td></tr> |
---|
241 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="70ed1fcb5802f4bd60009ed198c49c20"></a><!-- doxytag: member="itpp::Sparse_Vec::operator*=" ref="70ed1fcb5802f4bd60009ed198c49c20" args="(const T &v)" --> |
---|
242 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#70ed1fcb5802f4bd60009ed198c49c20">operator*=</a> (const T &v)</td></tr> |
---|
243 | |
---|
244 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Multiply the scalar <code>v</code> to all non-zero elements of the sparse vector. <br></td></tr> |
---|
245 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="16a5b698293b1e9ea3b79d4c5ce58934"></a><!-- doxytag: member="itpp::Sparse_Vec::operator/=" ref="16a5b698293b1e9ea3b79d4c5ce58934" args="(const T &v)" --> |
---|
246 | void </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#16a5b698293b1e9ea3b79d4c5ce58934">operator/=</a> (const T &v)</td></tr> |
---|
247 | |
---|
248 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Divide all non-zero elements of the sparse vector with the scalar <code>v</code>. <br></td></tr> |
---|
249 | <tr><td colspan="2"><br><h2>Friends</h2></td></tr> |
---|
250 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d65c6115bcf891f46506d02130451e5d"></a><!-- doxytag: member="itpp::Sparse_Vec::operator+" ref="d65c6115bcf891f46506d02130451e5d" args="(const Sparse_Vec< T > &v1, const Sparse_Vec< T > &v2)" --> |
---|
251 | <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#d65c6115bcf891f46506d02130451e5d">operator+</a> (const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v1, const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v2)</td></tr> |
---|
252 | |
---|
253 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Addition v1+v2 where v1 and v2 are sparse vector. <br></td></tr> |
---|
254 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="39952233c10daf6f92932d08ae04c66e"></a><!-- doxytag: member="itpp::Sparse_Vec::operator*" ref="39952233c10daf6f92932d08ae04c66e" args="(const Sparse_Vec< T > &v1, const Sparse_Vec< T > &v2)" --> |
---|
255 | T </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#39952233c10daf6f92932d08ae04c66e">operator*</a> (const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v1, const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v2)</td></tr> |
---|
256 | |
---|
257 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Scalar product v1*v2 where v1 and v2 are sparse vectors. <br></td></tr> |
---|
258 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0528e10b9c2a305461c4d273f3103aff"></a><!-- doxytag: member="itpp::Sparse_Vec::operator*" ref="0528e10b9c2a305461c4d273f3103aff" args="(const Sparse_Vec< T > &v1, const Vec< T > &v2)" --> |
---|
259 | T </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#0528e10b9c2a305461c4d273f3103aff">operator*</a> (const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v1, const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v2)</td></tr> |
---|
260 | |
---|
261 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Scalar product v1*v2 where v1 is a sparse vector and v2 is a dense vector. <br></td></tr> |
---|
262 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="42b220fb56be3d81b2c4f0cd27d1f68c"></a><!-- doxytag: member="itpp::Sparse_Vec::operator*" ref="42b220fb56be3d81b2c4f0cd27d1f68c" args="(const Vec< T > &v1, const Sparse_Vec< T > &v2)" --> |
---|
263 | T </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#42b220fb56be3d81b2c4f0cd27d1f68c">operator*</a> (const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v1, const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v2)</td></tr> |
---|
264 | |
---|
265 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Scalar product v1*v2 where v1 is a dense vector and v2 is a sparse vector. <br></td></tr> |
---|
266 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7d8ed50a6e2fa59502a9040de8b346c9"></a><!-- doxytag: member="itpp::Sparse_Vec::elem_mult" ref="7d8ed50a6e2fa59502a9040de8b346c9" args="(const Sparse_Vec< T > &v1, const Sparse_Vec< T > &v2)" --> |
---|
267 | <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#7d8ed50a6e2fa59502a9040de8b346c9">elem_mult</a> (const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v1, const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v2)</td></tr> |
---|
268 | |
---|
269 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Element wise multiplication of two sparse vectors. <br></td></tr> |
---|
270 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="93790b7d6a3dad14930d096cc792280e"></a><!-- doxytag: member="itpp::Sparse_Vec::elem_mult" ref="93790b7d6a3dad14930d096cc792280e" args="(const Sparse_Vec< T > &v1, const Vec< T > &v2)" --> |
---|
271 | <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#93790b7d6a3dad14930d096cc792280e">elem_mult</a> (const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v1, const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v2)</td></tr> |
---|
272 | |
---|
273 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Element wise multiplication of a sparse vector and a dense vector. <br></td></tr> |
---|
274 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1a2ea2fe22265bcb3460b597a8571d55"></a><!-- doxytag: member="itpp::Sparse_Vec::elem_mult_s" ref="1a2ea2fe22265bcb3460b597a8571d55" args="(const Sparse_Vec< T > &v1, const Vec< T > &v2)" --> |
---|
275 | <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#1a2ea2fe22265bcb3460b597a8571d55">elem_mult_s</a> (const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v1, const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v2)</td></tr> |
---|
276 | |
---|
277 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Element wise multiplication of a sparse vector and a dense vector returning a sparse vector. <br></td></tr> |
---|
278 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="233e9616ee861039c17ba18fd8034781"></a><!-- doxytag: member="itpp::Sparse_Vec::elem_mult" ref="233e9616ee861039c17ba18fd8034781" args="(const Vec< T > &v1, const Sparse_Vec< T > &v2)" --> |
---|
279 | <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#233e9616ee861039c17ba18fd8034781">elem_mult</a> (const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v1, const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v2)</td></tr> |
---|
280 | |
---|
281 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Element wise multiplication of a a dense vector and a sparse vector. <br></td></tr> |
---|
282 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="baf05b6b08bf3cc55c354f2faceeecd0"></a><!-- doxytag: member="itpp::Sparse_Vec::elem_mult_s" ref="baf05b6b08bf3cc55c354f2faceeecd0" args="(const Vec< T > &v1, const Sparse_Vec< T > &v2)" --> |
---|
283 | <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#baf05b6b08bf3cc55c354f2faceeecd0">elem_mult_s</a> (const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > &v1, const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > &v2)</td></tr> |
---|
284 | |
---|
285 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Element wise multiplication of a a dense vector and a sparse vector returning a sparse vector. <br></td></tr> |
---|
286 | <tr><td colspan="2"><br><h2>Related Functions</h2></td></tr> |
---|
287 | <tr><td colspan="2">(Note that these are not member functions.) <br><br></td></tr> |
---|
288 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9c7a34f62113a49ebdb45be6766d9b68"></a><!-- doxytag: member="itpp::Sparse_Vec::sparse_ivec" ref="9c7a34f62113a49ebdb45be6766d9b68" args="" --> |
---|
289 | typedef <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< int > </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#9c7a34f62113a49ebdb45be6766d9b68">sparse_ivec</a></td></tr> |
---|
290 | |
---|
291 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Type definition of an integer sparse vector. <br></td></tr> |
---|
292 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="fcc678091b4abbce7fc2cabb44366195"></a><!-- doxytag: member="itpp::Sparse_Vec::sparse_vec" ref="fcc678091b4abbce7fc2cabb44366195" args="" --> |
---|
293 | typedef <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< double > </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#fcc678091b4abbce7fc2cabb44366195">sparse_vec</a></td></tr> |
---|
294 | |
---|
295 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Type definition of a double sparse vector. <br></td></tr> |
---|
296 | <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a91a51f05c91ecbac0568b57d07b20ef"></a><!-- doxytag: member="itpp::Sparse_Vec::sparse_cvec" ref="a91a51f05c91ecbac0568b57d07b20ef" args="" --> |
---|
297 | typedef <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a><br class="typebreak"> |
---|
298 | < std::complex< double > > </td><td class="memItemRight" valign="bottom"><a class="el" href="classitpp_1_1Sparse__Vec.html#a91a51f05c91ecbac0568b57d07b20ef">sparse_cvec</a></td></tr> |
---|
299 | |
---|
300 | <tr><td class="mdescLeft"> </td><td class="mdescRight">Type definition of a complex<double> sparse vector. <br></td></tr> |
---|
301 | </table> |
---|
302 | <hr><a name="_details"></a><h2>Detailed Description</h2> |
---|
303 | <h3>template<class T><br> |
---|
304 | class itpp::Sparse_Vec< T ></h3> |
---|
305 | |
---|
306 | Templated sparse vector class. |
---|
307 | <p> |
---|
308 | <dl class="author" compact><dt><b>Author:</b></dt><dd>Tony Ottosson and Tobias Ringstrom</dd></dl> |
---|
309 | A sparse vector is a vector where most elements are zero. The maximum number of none-zero elements is a parameter to the constructor. The elements are stored in random order, i.e. they are not sorted. <hr><h2>Constructor & Destructor Documentation</h2> |
---|
310 | <a class="anchor" name="a0abee3a9c045d3093fb1becc3a4be32"></a><!-- doxytag: member="itpp::Sparse_Vec::Sparse_Vec" ref="a0abee3a9c045d3093fb1becc3a4be32" args="(int sz, int data_init=200)" --> |
---|
311 | <div class="memitem"> |
---|
312 | <div class="memproto"> |
---|
313 | <div class="memtemplate"> |
---|
314 | template<class T > </div> |
---|
315 | <table class="memname"> |
---|
316 | <tr> |
---|
317 | <td class="memname"><a class="el" href="classitpp_1_1Sparse__Vec.html">itpp::Sparse_Vec</a>< T >::<a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a> </td> |
---|
318 | <td>(</td> |
---|
319 | <td class="paramtype">int </td> |
---|
320 | <td class="paramname"> <em>sz</em>, </td> |
---|
321 | </tr> |
---|
322 | <tr> |
---|
323 | <td class="paramkey"></td> |
---|
324 | <td></td> |
---|
325 | <td class="paramtype">int </td> |
---|
326 | <td class="paramname"> <em>data_init</em> = <code>200</code></td><td> </td> |
---|
327 | </tr> |
---|
328 | <tr> |
---|
329 | <td></td> |
---|
330 | <td>)</td> |
---|
331 | <td></td><td></td><td><code> [inline]</code></td> |
---|
332 | </tr> |
---|
333 | </table> |
---|
334 | </div> |
---|
335 | <div class="memdoc"> |
---|
336 | |
---|
337 | <p> |
---|
338 | Initiate an empty sparse vector. |
---|
339 | <p> |
---|
340 | <dl compact><dt><b>Parameters:</b></dt><dd> |
---|
341 | <table border="0" cellspacing="2" cellpadding="0"> |
---|
342 | <tr><td valign="top"></td><td valign="top"><em>sz</em> </td><td>Size of the sparse vector (i.e. maximum index is (<code>sz</code> - 1)) </td></tr> |
---|
343 | <tr><td valign="top"></td><td valign="top"><em>data_init</em> </td><td>Maximum number of non-zero elements in the sparse vector (default value 200) </td></tr> |
---|
344 | </table> |
---|
345 | </dl> |
---|
346 | |
---|
347 | </div> |
---|
348 | </div><p> |
---|
349 | <a class="anchor" name="9fd90c90b73ec0d6a92a641f3c7dcc23"></a><!-- doxytag: member="itpp::Sparse_Vec::Sparse_Vec" ref="9fd90c90b73ec0d6a92a641f3c7dcc23" args="(const Sparse_Vec< T > &v)" --> |
---|
350 | <div class="memitem"> |
---|
351 | <div class="memproto"> |
---|
352 | <div class="memtemplate"> |
---|
353 | template<class T> </div> |
---|
354 | <table class="memname"> |
---|
355 | <tr> |
---|
356 | <td class="memname"><a class="el" href="classitpp_1_1Sparse__Vec.html">itpp::Sparse_Vec</a>< T >::<a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a> </td> |
---|
357 | <td>(</td> |
---|
358 | <td class="paramtype">const <a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a>< T > & </td> |
---|
359 | <td class="paramname"> <em>v</em> </td> |
---|
360 | <td> ) </td> |
---|
361 | <td><code> [inline]</code></td> |
---|
362 | </tr> |
---|
363 | </table> |
---|
364 | </div> |
---|
365 | <div class="memdoc"> |
---|
366 | |
---|
367 | <p> |
---|
368 | Initiate a new sparse vector. |
---|
369 | <p> |
---|
370 | <dl compact><dt><b>Parameters:</b></dt><dd> |
---|
371 | <table border="0" cellspacing="2" cellpadding="0"> |
---|
372 | <tr><td valign="top"></td><td valign="top"><em>v</em> </td><td>The elements of <code>v</code> are copied into the new sparse vector </td></tr> |
---|
373 | </table> |
---|
374 | </dl> |
---|
375 | |
---|
376 | <p>References <a class="el" href="svec_8h-source.html#l00326">itpp::Sparse_Vec< T >::check_small_elems_flag</a>, <a class="el" href="svec_8h-source.html#l00323">itpp::Sparse_Vec< T >::data</a>, <a class="el" href="svec_8h-source.html#l00322">itpp::Sparse_Vec< T >::data_size</a>, <a class="el" href="svec_8h-source.html#l00325">itpp::Sparse_Vec< T >::eps</a>, <a class="el" href="svec_8h-source.html#l00324">itpp::Sparse_Vec< T >::index</a>, <a class="el" href="svec_8h-source.html#l00322">itpp::Sparse_Vec< T >::used_size</a>, and <a class="el" href="svec_8h-source.html#l00322">itpp::Sparse_Vec< T >::v_size</a>.</p> |
---|
377 | |
---|
378 | </div> |
---|
379 | </div><p> |
---|
380 | <a class="anchor" name="cafcd2a02b1c37ffb519b02afcff2e25"></a><!-- doxytag: member="itpp::Sparse_Vec::Sparse_Vec" ref="cafcd2a02b1c37ffb519b02afcff2e25" args="(const Vec< T > &v)" --> |
---|
381 | <div class="memitem"> |
---|
382 | <div class="memproto"> |
---|
383 | <div class="memtemplate"> |
---|
384 | template<class T> </div> |
---|
385 | <table class="memname"> |
---|
386 | <tr> |
---|
387 | <td class="memname"><a class="el" href="classitpp_1_1Sparse__Vec.html">itpp::Sparse_Vec</a>< T >::<a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a> </td> |
---|
388 | <td>(</td> |
---|
389 | <td class="paramtype">const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > & </td> |
---|
390 | <td class="paramname"> <em>v</em> </td> |
---|
391 | <td> ) </td> |
---|
392 | <td><code> [inline]</code></td> |
---|
393 | </tr> |
---|
394 | </table> |
---|
395 | </div> |
---|
396 | <div class="memdoc"> |
---|
397 | |
---|
398 | <p> |
---|
399 | Initiate a new sparse vector from a dense vector. |
---|
400 | <p> |
---|
401 | <dl compact><dt><b>Parameters:</b></dt><dd> |
---|
402 | <table border="0" cellspacing="2" cellpadding="0"> |
---|
403 | <tr><td valign="top"></td><td valign="top"><em>v</em> </td><td>The elements of <code>v</code> are copied into the new sparse vector </td></tr> |
---|
404 | </table> |
---|
405 | </dl> |
---|
406 | |
---|
407 | <p>References <a class="el" href="svec_8h-source.html#l00543">itpp::Sparse_Vec< T >::compact()</a>, <a class="el" href="tcp_8h-source.html#l00115">itpp::min()</a>, <a class="el" href="svec_8h-source.html#l00520">itpp::Sparse_Vec< T >::resize_data()</a>, and <a class="el" href="vec_8h-source.html#l00277">itpp::Vec< Num_T >::size()</a>.</p> |
---|
408 | |
---|
409 | </div> |
---|
410 | </div><p> |
---|
411 | <a class="anchor" name="11808d0c9a62f8a68707567efe82e19f"></a><!-- doxytag: member="itpp::Sparse_Vec::Sparse_Vec" ref="11808d0c9a62f8a68707567efe82e19f" args="(const Vec< T > &v, T epsilon)" --> |
---|
412 | <div class="memitem"> |
---|
413 | <div class="memproto"> |
---|
414 | <div class="memtemplate"> |
---|
415 | template<class T> </div> |
---|
416 | <table class="memname"> |
---|
417 | <tr> |
---|
418 | <td class="memname"><a class="el" href="classitpp_1_1Sparse__Vec.html">itpp::Sparse_Vec</a>< T >::<a class="el" href="classitpp_1_1Sparse__Vec.html">Sparse_Vec</a> </td> |
---|
419 | <td>(</td> |
---|
420 | <td class="paramtype">const <a class="el" href="classitpp_1_1Vec.html">Vec</a>< T > & </td> |
---|
421 | <td class="paramname"> <em>v</em>, </td> |
---|
422 | </tr> |
---|
423 | <tr> |
---|
424 | <td class="paramkey"></td> |
---|
425 | <td></td> |
---|
426 | <td class="paramtype">T </td> |
---|
427 | <td class="paramname"> <em>epsilon</em></td><td> </td> |
---|
428 | </tr> |
---|
429 | <tr> |
---|
430 | <td></td> |
---|
431 | <td>)</td> |
---|
432 | <td></td><td></td><td><code> [inline]</code></td> |
---|
433 | </tr> |
---|
434 | </table> |
---|
435 | </div> |
---|
436 | <div class="memdoc"> |
---|
437 | |
---|
438 | <p> |
---|
439 | Initiate a new sparse vector from a dense vector. Elements of <code>v</code> larger than <code>epsilon</code> are copied into the new sparse vector. |
---|
440 | <p> |
---|
441 | <dl class="note" compact><dt><b>Note:</b></dt><dd>If the type T is complex<double>, then the elements of <code>v</code> larger than <code>abs(epsilon)</code> are copied into the new sparse vector. </dd></dl> |
---|
442 | |
---|
443 | <p>References <a class="el" href="fix__functions_8cpp-source.html#l00076">itpp::abs()</a>, <a class="el" href="svec_8h-source.html#l00543">itpp::Sparse_Vec< T >::compact()</a>, <a class="el" href="tcp_8h-source.html#l00115">itpp::min()</a>, <a class="el" href="svec_8h-source.html#l00520">itpp::Sparse_Vec< T >::resize_data()</a>, and <a class="el" href="vec_8h-source.html#l00277">itpp::Vec< Num_T >::size()</a>.</p> |
---|
444 | |
---|
445 | </div> |
---|
446 | </div><p> |
---|
447 | <hr><h2>Member Function Documentation</h2> |
---|
448 | <a class="anchor" name="f4a70276d329e74da185b4b331fbcfa6"></a><!-- doxytag: member="itpp::Sparse_Vec::remove_small_elements" ref="f4a70276d329e74da185b4b331fbcfa6" args="()" --> |
---|
449 | <div class="memitem"> |
---|
450 | <div class="memproto"> |
---|
451 | <div class="memtemplate"> |
---|
452 | template<class T > </div> |
---|
453 | <table class="memname"> |
---|
454 | <tr> |
---|
455 | <td class="memname">void <a class="el" href="classitpp_1_1Sparse__Vec.html">itpp::Sparse_Vec</a>< T >::remove_small_elements </td> |
---|
456 | <td>(</td> |
---|
457 | <td class="paramname"> </td> |
---|
458 | <td> ) </td> |
---|
459 | <td><code> [inline]</code></td> |
---|
460 | </tr> |
---|
461 | </table> |
---|
462 | </div> |
---|
463 | <div class="memdoc"> |
---|
464 | |
---|
465 | <p> |
---|
466 | Removes all elements that are smaller than <em>epsilon</em> from the non-zero elements.<p> |
---|
467 | <dl class="note" compact><dt><b>Note:</b></dt><dd>The small element <em>epsilon</em> can be set by the member function set_small_element. If no small value is set, the default value is always <code>epsilon=0</code>. </dd></dl> |
---|
468 | |
---|
469 | <p>References <a class="el" href="fix__functions_8cpp-source.html#l00076">itpp::abs()</a>.</p> |
---|
470 | |
---|
471 | <p>Referenced by <a class="el" href="svec_8h-source.html#l00543">itpp::Sparse_Vec< T >::compact()</a>, <a class="el" href="svec_8h-source.html#l00476">itpp::Sparse_Vec< T >::density()</a>, <a class="el" href="svec_8h-source.html#l00247">itpp::Sparse_Vec< bin >::get_nz()</a>, <a class="el" href="svec_8h-source.html#l00223">itpp::Sparse_Vec< bin >::get_nz_data()</a>, <a class="el" href="svec_8h-source.html#l00239">itpp::Sparse_Vec< bin >::get_nz_index()</a>, <a class="el" href="svec_8h-source.html#l00151">itpp::Sparse_Vec< bin >::nnz()</a>, <a class="el" href="svec_8h-source.html#l00887">itpp::Sparse_Vec< T >::operator==()</a>, <a class="el" href="svec_8h-source.html#l00587">itpp::Sparse_Vec< T >::set()</a>, and <a class="el" href="svec_8h-source.html#l00486">itpp::Sparse_Vec< T >::set_small_element()</a>.</p> |
---|
472 | |
---|
473 | </div> |
---|
474 | </div><p> |
---|
475 | <a class="anchor" name="e13e88712aafec410acce936dc708073"></a><!-- doxytag: member="itpp::Sparse_Vec::resize_data" ref="e13e88712aafec410acce936dc708073" args="(int new_size)" --> |
---|
476 | <div class="memitem"> |
---|
477 | <div class="memproto"> |
---|
478 | <div class="memtemplate"> |
---|
479 | template<class T > </div> |
---|
480 | <table class="memname"> |
---|
481 | <tr> |
---|
482 | <td class="memname">void <a class="el" href="classitpp_1_1Sparse__Vec.html">itpp::Sparse_Vec</a>< T >::resize_data </td> |
---|
483 | <td>(</td> |
---|
484 | <td class="paramtype">int </td> |
---|
485 | <td class="paramname"> <em>new_size</em> </td> |
---|
486 | <td> ) </td> |
---|
487 | <td><code> [inline]</code></td> |
---|
488 | </tr> |
---|
489 | </table> |
---|
490 | </div> |
---|
491 | <div class="memdoc"> |
---|
492 | |
---|
493 | <p> |
---|
494 | Set the maximum number of non-zero elements to <code>new_size</code>. |
---|
495 | <p> |
---|
496 | <dl compact><dt><b>Parameters:</b></dt><dd> |
---|
497 | <table border="0" cellspacing="2" cellpadding="0"> |
---|
498 | <tr><td valign="top"></td><td valign="top"><em>new_size</em> </td><td>The new maximum number of non-zero elements. </td></tr> |
---|
499 | </table> |
---|
500 | </dl> |
---|
501 | |
---|
502 | <p>References <a class="el" href="itassert_8h-source.html#l00094">it_assert</a>.</p> |
---|
503 | |
---|
504 | <p>Referenced by <a class="el" href="svec_8h-source.html#l00665">itpp::Sparse_Vec< T >::add()</a>, <a class="el" href="svec_8h-source.html#l00637">itpp::Sparse_Vec< T >::add_elem()</a>, <a class="el" href="svec_8h-source.html#l00543">itpp::Sparse_Vec< T >::compact()</a>, <a class="el" href="svec_8h-source.html#l00800">itpp::Sparse_Vec< T >::get_subvector()</a>, <a class="el" href="svec_8h-source.html#l00850">itpp::Sparse_Vec< T >::operator=()</a>, <a class="el" href="svec_8h-source.html#l00587">itpp::Sparse_Vec< T >::set()</a>, <a class="el" href="svec_8h-source.html#l00622">itpp::Sparse_Vec< T >::set_new()</a>, and <a class="el" href="svec_8h-source.html#l00414">itpp::Sparse_Vec< T >::Sparse_Vec()</a>.</p> |
---|
505 | |
---|
506 | </div> |
---|
507 | </div><p> |
---|
508 | <a class="anchor" name="1f542b437bdf9942b3f386ccc6e53577"></a><!-- doxytag: member="itpp::Sparse_Vec::set_size" ref="1f542b437bdf9942b3f386ccc6e53577" args="(int sz, int data_init=-1)" --> |
---|
509 | <div class="memitem"> |
---|
510 | <div class="memproto"> |
---|
511 | <div class="memtemplate"> |
---|
512 | template<class T > </div> |
---|
513 | <table class="memname"> |
---|
514 | <tr> |
---|
515 | <td class="memname">void <a class="el" href="classitpp_1_1Sparse__Vec.html">itpp::Sparse_Vec</a>< T >::set_size </td> |
---|
516 | <td>(</td> |
---|
517 | <td class="paramtype">int </td> |
---|
518 | <td class="paramname"> <em>sz</em>, </td> |
---|
519 | </tr> |
---|
520 | <tr> |
---|
521 | <td class="paramkey"></td> |
---|
522 | <td></td> |
---|
523 | <td class="paramtype">int </td> |
---|
524 | <td class="paramname"> <em>data_init</em> = <code>-1</code></td><td> </td> |
---|
525 | </tr> |
---|
526 | <tr> |
---|
527 | <td></td> |
---|
528 | <td>)</td> |
---|
529 | <td></td><td></td><td><code> [inline]</code></td> |
---|
530 | </tr> |
---|
531 | </table> |
---|
532 | </div> |
---|
533 | <div class="memdoc"> |
---|
534 | |
---|
535 | <p> |
---|
536 | Set the size <code>sz</code> of the sparse vector. Default value <code>data_init=-1</code> <code>=></code> allocated size for the data is not changed. |
---|
537 | <p> |
---|
538 | <dl compact><dt><b>Parameters:</b></dt><dd> |
---|
539 | <table border="0" cellspacing="2" cellpadding="0"> |
---|
540 | <tr><td valign="top"></td><td valign="top"><em>sz</em> </td><td>Size of the sparse vector (i.e. maximum index is (<code>sz</code> - 1)) </td></tr> |
---|
541 | <tr><td valign="top"></td><td valign="top"><em>data_init</em> </td><td>Maximum number of non-zero elements in the sparse vector (default value -1 <code>=></code> allocated size for the data is not changed) </td></tr> |
---|
542 | </table> |
---|
543 | </dl> |
---|
544 | |
---|
545 | </div> |
---|
546 | </div><p> |
---|
547 | <hr>The documentation for this class was generated from the following file:<ul> |
---|
548 | <li><a class="el" href="svec_8h-source.html">svec.h</a></ul> |
---|
549 | </div> |
---|
550 | <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:19 2009 for mixpp by |
---|
551 | <a href="http://www.doxygen.org/index.html"> |
---|
552 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> |
---|
553 | </body> |
---|
554 | </html> |
---|