mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-10-31 13:10:19 -04:00 
			
		
		
		
	
		
			
	
	
		
			801 lines
		
	
	
		
			26 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
		
		
			
		
	
	
			801 lines
		
	
	
		
			26 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
|  | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
|  |     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
|  | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
|  | <head> | ||
|  | <meta name="generator" content= | ||
|  | "HTML Tidy for Linux/x86 (vers 1st March 2004), see www.w3.org" /> | ||
|  | <meta http-equiv="Content-Type" content= | ||
|  | "text/html; charset=us-ascii" /> | ||
|  | <link href="ublas.css" type="text/css" /> | ||
|  | <link rel="stylesheet" href="../../../../boost.css" type="text/css"/> | ||
|  | <link rel="stylesheet" href="ublas.css" type="text/css" /> | ||
|  | <script type="text/javascript" src="js/jquery-1.3.2.min.js" async="async" ></script> | ||
|  | <script type="text/javascript" src="js/jquery.toc-gw.js" async="async" ></script> | ||
|  | </head> | ||
|  | <body> | ||
|  | <h1><img src="../../../../boost.png" align="middle" />Sparse Vector</h1> | ||
|  | <div class="toc" id="toc"></div> | ||
|  | <h2><a name="mapped_vector"></a>Mapped Vector</h2> | ||
|  | <h4>Description</h4> | ||
|  | <p>The templated class <code>mapped_vector<T, A></code> is | ||
|  | the base container adaptor for sparse vectors using element maps. For a | ||
|  | <em>n</em>-dimensional sparse vector and <em>0 <= i < n</em> | ||
|  | the non-zero elements <em>v</em><sub><em>i</em></sub> are mapped to | ||
|  | consecutive elements of the associative container, i.e. for | ||
|  | elements <em>k</em> = | ||
|  | <em>v</em><sub><em>i</em></sub><sub><sub><em>1</em></sub></sub>and | ||
|  | <em>k + 1 = | ||
|  | v</em><sub><em>i</em></sub><sub><sub><em>2</em></sub></sub>of the | ||
|  | container holds <em>i</em><sub><em>1</em></sub> <em>< | ||
|  | i</em><sub><em>2</em></sub>.</p> | ||
|  | <h4>Example</h4> | ||
|  | <pre> | ||
|  | #include <boost/numeric/ublas/vector_sparse.hpp> | ||
|  | #include <boost/numeric/ublas/io.hpp> | ||
|  | 
 | ||
|  | int main () { | ||
|  |     using namespace boost::numeric::ublas; | ||
|  |     mapped_vector<double> v (3, 3); | ||
|  |     for (unsigned i = 0; i < v.size (); ++ i) | ||
|  |         v (i) = i; | ||
|  |     std::cout << v << std::endl; | ||
|  | } | ||
|  | </pre> | ||
|  | <h4>Definition</h4> | ||
|  | <p>Defined in the header vector_sparse.hpp.</p> | ||
|  | <h4>Template parameters</h4> | ||
|  | <table border="1" summary="parameters"> | ||
|  | <tbody> | ||
|  | <tr> | ||
|  | <th>Parameter</th> | ||
|  | <th>Description</th> | ||
|  | <th>Default</th> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>T</code></td> | ||
|  | <td>The type of object stored in the mapped vector.</td> | ||
|  | <td></td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>A</code></td> | ||
|  | <td>The type of the adapted array. <a href= | ||
|  | "#mapped_vector_1">[1]</a></td> | ||
|  | <td><code>map_std<std::size_t, T></code></td> | ||
|  | </tr> | ||
|  | </tbody> | ||
|  | </table> | ||
|  | <h4>Model of</h4> | ||
|  | <p><a href="container_concept.html#vector">Vector</a> .</p> | ||
|  | <h4>Type requirements</h4> | ||
|  | <p>None, except for those imposed by the requirements of <a href= | ||
|  | "container_concept.html#vector">Vector</a> .</p> | ||
|  | <h4>Public base classes</h4> | ||
|  | <p><code>vector_container<mapped_vector<T, A> | ||
|  | ></code></p> | ||
|  | <h4>Members</h4> | ||
|  | <table border="1" summary="members"> | ||
|  | <tbody> | ||
|  | <tr> | ||
|  | <th>Member</th> | ||
|  | <th>Description</th> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>mapped_vector ()</code></td> | ||
|  | <td>Allocates a <code>mapped_vector</code> that holds zero | ||
|  | elements.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>mapped_vector (size_type size, size_type | ||
|  | non_zeros = 0)</code></td> | ||
|  | <td>Allocates a <code>mapped_vector</code> that holds at most | ||
|  | <code>size</code> elements.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>mapped_vector (const mapped_vector &v)</code></td> | ||
|  | <td>The copy constructor.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | mapped_vector (size_type non_zeros, const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>The extended copy constructor.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void resize (size_type size, bool | ||
|  | preserve = true)</code></td> | ||
|  | <td>Reallocates a <code>mapped_vector</code> to hold at most | ||
|  | <code>size</code> elements. The existing elements of the | ||
|  | <code>mapped_vector</code> are preseved when specified.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>size_type size () const</code></td> | ||
|  | <td>Returns the size of the <code>mapped_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_reference operator () (size_type i) | ||
|  | const</code></td> | ||
|  | <td>Returns the value of the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>reference operator () (size_type i)</code></td> | ||
|  | <td>Returns a reference of the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_reference operator [] (size_type i) | ||
|  | const</code></td> | ||
|  | <td>Returns the value of the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>reference operator [] (size_type i)</code></td> | ||
|  | <td>Returns a reference of the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>mapped_vector &operator = (const mapped_vector | ||
|  | &v)</code></td> | ||
|  | <td>The assignment operator.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>mapped_vector &assign_temporary (mapped_vector | ||
|  | &v)</code></td> | ||
|  | <td>Assigns a temporary. May change the mapped vector | ||
|  | <code>v</code> .</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | mapped_vector &operator = (const vector_expression<AE> | ||
|  | &ae)</code></td> | ||
|  | <td>The extended assignment operator.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | mapped_vector &assign (const vector_expression<AE> | ||
|  | &ae)</code></td> | ||
|  | <td>Assigns a vector expression to the mapped vector. Left and | ||
|  | right hand side of the assignment should be independent.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | mapped_vector &operator += (const vector_expression<AE> | ||
|  | &ae)</code></td> | ||
|  | <td>A computed assignment operator. Adds the vector expression to | ||
|  | the mapped vector.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | mapped_vector &plus_assign (const vector_expression<AE> | ||
|  | &ae)</code></td> | ||
|  | <td>Adds a vector expression to the mapped vector. Left and right | ||
|  | hand side of the assignment should be independent.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | mapped_vector &operator -= (const vector_expression<AE> | ||
|  | &ae)</code></td> | ||
|  | <td>A computed assignment operator. Subtracts the vector expression | ||
|  | from the mapped vector.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | mapped_vector &minus_assign (const vector_expression<AE> | ||
|  | &ae)</code></td> | ||
|  | <td>Subtracts a vector expression from the mapped vector. Left and | ||
|  | right hand side of the assignment should be independent.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AT><br /> | ||
|  | mapped_vector &operator *= (const AT &at)</code></td> | ||
|  | <td>A computed assignment operator. Multiplies the mapped vector | ||
|  | with a scalar.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AT><br /> | ||
|  | mapped_vector &operator /= (const AT &at)</code></td> | ||
|  | <td>A computed assignment operator. Divides the mapped vector | ||
|  | through a scalar.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void swap (mapped_vector &v)</code></td> | ||
|  | <td>Swaps the contents of the mapped vectors.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>true_reference insert_element (size_type i, const_reference t)</code></td> | ||
|  | <td>Inserts the value <code>t</code> at the <code>i</code>-th | ||
|  | element. Duplicates elements are not allowed.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void erase_element (size_type i)</code></td> | ||
|  | <td>Erases the value at the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void clear ()</code></td> | ||
|  | <td>Clears the mapped vector.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_iterator begin () const</code></td> | ||
|  | <td>Returns a <code>const_iterator</code> pointing to the beginning | ||
|  | of the <code>mapped_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_iterator end () const</code></td> | ||
|  | <td>Returns a <code>const_iterator</code> pointing to the end of | ||
|  | the <code>mapped_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>iterator begin ()</code></td> | ||
|  | <td>Returns a <code>iterator</code> pointing to the beginning of | ||
|  | the <code>mapped_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>iterator end ()</code></td> | ||
|  | <td>Returns a <code>iterator</code> pointing to the end of the | ||
|  | <code>mapped_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_reverse_iterator rbegin () const</code></td> | ||
|  | <td>Returns a <code>const_reverse_iterator</code> pointing to the | ||
|  | beginning of the reversed <code>mapped_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_reverse_iterator rend () const</code></td> | ||
|  | <td>Returns a <code>const_reverse_iterator</code> pointing to the | ||
|  | end of the reversed <code>mapped_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>reverse_iterator rbegin ()</code></td> | ||
|  | <td>Returns a <code>reverse_iterator</code> pointing to the | ||
|  | beginning of the reversed <code>mapped_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>reverse_iterator rend ()</code></td> | ||
|  | <td>Returns a <code>reverse_iterator</code> pointing to the end of | ||
|  | the reversed <code>mapped_vector</code>.</td> | ||
|  | </tr> | ||
|  | </tbody> | ||
|  | </table> | ||
|  | <h4>Notes</h4> | ||
|  | <p><a name="mapped_vector_1">[1]</a> Supported | ||
|  | parameters for the adapted array are | ||
|  | <code>map_array<std::size_t, T></code> and | ||
|  | <code>map_std<std::size_t, T></code>. The latter is | ||
|  | equivalent to <code>std::map<std::size_t, T></code>.</p> | ||
|  | <h2><a name="compressed_vector"></a>Compressed Vector</h2> | ||
|  | <h4>Description</h4> | ||
|  | <p>The templated class <code>compressed_vector<T, IB, IA, | ||
|  | TA></code> is the base container adaptor for compressed vectors. | ||
|  | For a <em>n</em>-dimensional compressed vector and <em>0 <= i | ||
|  | < n</em> the non-zero elements <em>v</em><sub><em>i</em></sub> | ||
|  | are mapped to consecutive elements of the index and value | ||
|  | container, i.e. for elements <em>k</em> = | ||
|  | <em>v</em><sub><em>i</em></sub><sub><sub><em>1</em></sub></sub>and | ||
|  | <em>k + 1 = | ||
|  | v</em><sub><em>i</em></sub><sub><sub><em>2</em></sub></sub>of these | ||
|  | containers holds <em>i</em><sub><em>1</em></sub> <em>< | ||
|  | i</em><sub><em>2</em></sub>.</p> | ||
|  | <h4>Example</h4> | ||
|  | <pre> | ||
|  | #include <boost/numeric/ublas/vector_sparse.hpp> | ||
|  | #include <boost/numeric/ublas/io.hpp> | ||
|  | 
 | ||
|  | int main () { | ||
|  |     using namespace boost::numeric::ublas; | ||
|  |     compressed_vector<double> v (3, 3); | ||
|  |     for (unsigned i = 0; i < v.size (); ++ i) | ||
|  |         v (i) = i; | ||
|  |     std::cout << v << std::endl; | ||
|  | } | ||
|  | </pre> | ||
|  | <h4>Definition</h4> | ||
|  | <p>Defined in the header vector_sparse.hpp.</p> | ||
|  | <h4>Template parameters</h4> | ||
|  | <table border="1" summary="parameters"> | ||
|  | <tbody> | ||
|  | <tr> | ||
|  | <th>Parameter</th> | ||
|  | <th>Description</th> | ||
|  | <th>Default</th> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>T</code></td> | ||
|  | <td>The type of object stored in the compressed vector.</td> | ||
|  | <td></td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>IB</code></td> | ||
|  | <td>The index base of the compressed vector. <a href= | ||
|  | "#compressed_vector_1">[1]</a></td> | ||
|  | <td><code>0</code></td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>IA</code></td> | ||
|  | <td>The type of the adapted array for indices. <a href= | ||
|  | "#compressed_vector_2">[2]</a></td> | ||
|  | <td><code>unbounded_array<std::size_t></code></td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>TA</code></td> | ||
|  | <td>The type of the adapted array for values. <a href= | ||
|  | "#compressed_vector_2">[2]</a></td> | ||
|  | <td><code>unbounded_array<T></code></td> | ||
|  | </tr> | ||
|  | </tbody> | ||
|  | </table> | ||
|  | <h4>Model of</h4> | ||
|  | <p><a href="container_concept.html#vector">Vector</a> .</p> | ||
|  | <h4>Type requirements</h4> | ||
|  | <p>None, except for those imposed by the requirements of <a href= | ||
|  | "container_concept.html#vector">Vector</a> .</p> | ||
|  | <h4>Public base classes</h4> | ||
|  | <p><code>vector_container<compressed_vector<T, IB, IA, | ||
|  | TA> ></code></p> | ||
|  | <h4>Members</h4> | ||
|  | <table border="1" summary="members"> | ||
|  | <tbody> | ||
|  | <tr> | ||
|  | <th>Member</th> | ||
|  | <th>Description</th> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>compressed_vector ()</code></td> | ||
|  | <td>Allocates a <code>compressed_vector</code> that holds zero | ||
|  | elements.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>compressed_vector (size_type size, size_type | ||
|  | non_zeros)</code></td> | ||
|  | <td>Allocates a <code>compressed_vector</code> that holds at most | ||
|  | <code>size</code> elements.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>compressed_vector (const compressed_vector | ||
|  | &v)</code></td> | ||
|  | <td>The copy constructor.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | compressed_vector (size_type non_zeros, const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>The extended copy constructor.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void resize (size_type size, bool | ||
|  | preserve = true)</code></td> | ||
|  | <td>Reallocates a <code>compressed_vector</code> to hold at most | ||
|  | <code>size</code> elements. The existing elements of the | ||
|  | <code>compress_vector</code> are preseved when specified.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>size_type size () const</code></td> | ||
|  | <td>Returns the size of the <code>compressed_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_reference operator () (size_type i) | ||
|  | const</code></td> | ||
|  | <td>Returns the value of the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>reference operator () (size_type i)</code></td> | ||
|  | <td>Returns a reference of the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_reference operator [] (size_type i) | ||
|  | const</code></td> | ||
|  | <td>Returns the value of the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>reference operator [] (size_type i)</code></td> | ||
|  | <td>Returns a reference of the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>compressed_vector &operator = (const | ||
|  | compressed_vector &v)</code></td> | ||
|  | <td>The assignment operator.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>compressed_vector &assign_temporary | ||
|  | (compressed_vector &v)</code></td> | ||
|  | <td>Assigns a temporary. May change the compressed vector | ||
|  | <code>v</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | compressed_vector &operator = (const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>The extended assignment operator.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | compressed_vector &assign (const vector_expression<AE> | ||
|  | &ae)</code></td> | ||
|  | <td>Assigns a vector expression to the compressed vector. Left and | ||
|  | right hand side of the assignment should be independent.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | compressed_vector &operator += (const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>A computed assignment operator. Adds the vector expression to | ||
|  | the compressed vector.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | compressed_vector &plus_assign (const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>Adds a vector expression to the compressed vector. Left and | ||
|  | right hand side of the assignment should be independent.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | compressed_vector &operator -= (const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>A computed assignment operator. Subtracts the vector expression | ||
|  | from the compressed vector.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | compressed_vector &minus_assign (const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>Subtracts a vector expression from the compressed vector. Left | ||
|  | and right hand side of the assignment should be independent.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AT><br /> | ||
|  | compressed_vector &operator *= (const AT &at)</code></td> | ||
|  | <td>A computed assignment operator. Multiplies the compressed | ||
|  | vector with a scalar.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AT><br /> | ||
|  | compressed_vector &operator /= (const AT &at)</code></td> | ||
|  | <td>A computed assignment operator. Divides the compressed vector | ||
|  | through a scalar.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void swap (compressed_vector &v)</code></td> | ||
|  | <td>Swaps the contents of the compressed vectors.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>true_reference insert_element (size_type i, const_reference t)</code></td> | ||
|  | <td>Inserts the value <code>t</code> at the <code>i</code>-th | ||
|  | element. Duplicates elements are not allowed.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void erase_element (size_type i)</code></td> | ||
|  | <td>Erases the value at the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void clear ()</code></td> | ||
|  | <td>Clears the compressed vector.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_iterator begin () const</code></td> | ||
|  | <td>Returns a <code>const_iterator</code> pointing to the beginning | ||
|  | of the <code>compressed_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_iterator end () const</code></td> | ||
|  | <td>Returns a <code>const_iterator</code> pointing to the end of | ||
|  | the <code>compressed_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>iterator begin ()</code></td> | ||
|  | <td>Returns a <code>iterator</code> pointing to the beginning of | ||
|  | the <code>compressed_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>iterator end ()</code></td> | ||
|  | <td>Returns a <code>iterator</code> pointing to the end of the | ||
|  | <code>compressed_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_reverse_iterator rbegin () const</code></td> | ||
|  | <td>Returns a <code>const_reverse_iterator</code> pointing to the | ||
|  | beginning of the reversed <code>compressed_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_reverse_iterator rend () const</code></td> | ||
|  | <td>Returns a <code>const_reverse_iterator</code> pointing to the | ||
|  | end of the reversed <code>compressed_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>reverse_iterator rbegin ()</code></td> | ||
|  | <td>Returns a <code>reverse_iterator</code> pointing to the | ||
|  | beginning of the reversed <code>compressed_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>reverse_iterator rend ()</code></td> | ||
|  | <td>Returns a <code>reverse_iterator</code> pointing to the end of | ||
|  | the reversed <code>compressed_vector</code>.</td> | ||
|  | </tr> | ||
|  | </tbody> | ||
|  | </table> | ||
|  | <h4>Notes</h4> | ||
|  | <p><a name="compressed_vector_1">[1]</a> | ||
|  | Supported parameters for the index base are <code>0</code> and | ||
|  | <code>1</code> at least.</p> | ||
|  | <p><a name="compressed_vector_2">[2]</a> | ||
|  | Supported parameters for the adapted array are | ||
|  | <code>unbounded_array<></code> , | ||
|  | <code>bounded_array<></code> and | ||
|  | <code>std::vector<></code> .</p> | ||
|  | <h2><a name="coordinate_vector"></a>Coordinate Vector</h2> | ||
|  | <h4>Description</h4> | ||
|  | <p>The templated class <code>coordinate_vector<T, IB, IA, | ||
|  | TA></code> is the base container adaptor for compressed vectors. | ||
|  | For a <em>n</em>-dimensional sorted coordinate vector and <em>0 | ||
|  | <= i < n</em> the non-zero elements | ||
|  | <em>v</em><sub><em>i</em></sub> are mapped to consecutive elements | ||
|  | of the index and value container, i.e. for elements <em>k</em> = | ||
|  | <em>v</em><sub><em>i</em></sub><sub><sub><em>1</em></sub></sub>and | ||
|  | <em>k + 1 = | ||
|  | v</em><sub><em>i</em></sub><sub><sub><em>2</em></sub></sub>of these | ||
|  | containers holds <em>i</em><sub><em>1</em></sub> <em>< | ||
|  | i</em><sub><em>2</em></sub>.</p> | ||
|  | <h4>Example</h4> | ||
|  | <pre> | ||
|  | #include <boost/numeric/ublas/vector_sparse.hpp> | ||
|  | #include <boost/numeric/ublas/io.hpp> | ||
|  | 
 | ||
|  | int main () { | ||
|  |     using namespace boost::numeric::ublas; | ||
|  |     coordinate_vector<double> v (3, 3); | ||
|  |     for (unsigned i = 0; i < v.size (); ++ i) | ||
|  |         v (i) = i; | ||
|  |     std::cout << v << std::endl; | ||
|  | } | ||
|  | </pre> | ||
|  | <h4>Definition</h4> | ||
|  | <p>Defined in the header vector_sparse.hpp.</p> | ||
|  | <h4>Template parameters</h4> | ||
|  | <table border="1" summary="parameters"> | ||
|  | <tbody> | ||
|  | <tr> | ||
|  | <th>Parameter</th> | ||
|  | <th>Description</th> | ||
|  | <th>Default</th> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>T</code></td> | ||
|  | <td>The type of object stored in the coordinate vector.</td> | ||
|  | <td></td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>IB</code></td> | ||
|  | <td>The index base of the coordinate vector. <a href= | ||
|  | "#coordinate_vector_1">[1]</a></td> | ||
|  | <td><code>0</code></td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>IA</code></td> | ||
|  | <td>The type of the adapted array for indices. <a href= | ||
|  | "#coordinate_vector_2">[2]</a></td> | ||
|  | <td><code>unbounded_array<std::size_t></code></td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>TA</code></td> | ||
|  | <td>The type of the adapted array for values. <a href= | ||
|  | "#coordinate_vector_2">[2]</a></td> | ||
|  | <td><code>unbounded_array<T></code></td> | ||
|  | </tr> | ||
|  | </tbody> | ||
|  | </table> | ||
|  | <h4>Model of</h4> | ||
|  | <p><a href="container_concept.html#vector">Vector</a> .</p> | ||
|  | <h4>Type requirements</h4> | ||
|  | <p>None, except for those imposed by the requirements of <a href= | ||
|  | "container_concept.html#vector">Vector</a> .</p> | ||
|  | <h4>Public base classes</h4> | ||
|  | <p><code>vector_container<coordinate_vector<T, IB, IA, | ||
|  | TA> ></code></p> | ||
|  | <h4>Members</h4> | ||
|  | <table border="1" summary="members"> | ||
|  | <tbody> | ||
|  | <tr> | ||
|  | <th>Member</th> | ||
|  | <th>Description</th> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>coordinate_vector ()</code></td> | ||
|  | <td>Allocates a <code>coordinate_vector</code> that holds zero | ||
|  | elements.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>coordinate_vector (size_type size, size_type | ||
|  | non_zeros)</code></td> | ||
|  | <td>Allocates a <code>coordinate_vector</code> that holds at most | ||
|  | <code>size</code> elements.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>coordinate_vector (const coordinate_vector | ||
|  | &v)</code></td> | ||
|  | <td>The copy constructor.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | coordinate_vector (size_type non_zeros, const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>The extended copy constructor.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void resize (size_type size, bool | ||
|  | preserve = true)</code></td> | ||
|  | <td>Reallocates a <code>coordinate_vector</code> to hold at most | ||
|  | <code>size</code> elements. The existing elements of the | ||
|  | <code>coordinate_vector</code> are preseved when specified.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>size_type size () const</code></td> | ||
|  | <td>Returns the size of the <code>coordinate_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_reference operator () (size_type i) | ||
|  | const</code></td> | ||
|  | <td>Returns the value of the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>reference operator () (size_type i)</code></td> | ||
|  | <td>Returns a reference of the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_reference operator [] (size_type i) | ||
|  | const</code></td> | ||
|  | <td>Returns the value of the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>reference operator [] (size_type i)</code></td> | ||
|  | <td>Returns a reference of the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>coordinate_vector &operator = (const | ||
|  | coordinate_vector &v)</code></td> | ||
|  | <td>The assignment operator.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>coordinate_vector &assign_temporary | ||
|  | (coordinate_vector &v)</code></td> | ||
|  | <td>Assigns a temporary. May change the coordinate vector | ||
|  | <code>v</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | coordinate_vector &operator = (const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>The extended assignment operator.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | coordinate_vector &assign (const vector_expression<AE> | ||
|  | &ae)</code></td> | ||
|  | <td>Assigns a vector expression to the coordinate vector. Left and | ||
|  | right hand side of the assignment should be independent.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | coordinate_vector &operator += (const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>A computed assignment operator. Adds the vector expression to | ||
|  | the coordinate vector.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | coordinate_vector &plus_assign (const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>Adds a vector expression to the coordinate vector. Left and | ||
|  | right hand side of the assignment should be independent.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | coordinate_vector &operator -= (const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>A computed assignment operator. Subtracts the vector expression | ||
|  | from the coordinate vector.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AE><br /> | ||
|  | coordinate_vector &minus_assign (const | ||
|  | vector_expression<AE> &ae)</code></td> | ||
|  | <td>Subtracts a vector expression from the coordinate vector. Left | ||
|  | and right hand side of the assignment should be independent.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AT><br /> | ||
|  | coordinate_vector &operator *= (const AT &at)</code></td> | ||
|  | <td>A computed assignment operator. Multiplies the coordinate | ||
|  | vector with a scalar.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>template<class AT><br /> | ||
|  | coordinate_vector &operator /= (const AT &at)</code></td> | ||
|  | <td>A computed assignment operator. Divides the coordinate vector | ||
|  | through a scalar.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void swap (coordinate_vector &v)</code></td> | ||
|  | <td>Swaps the contents of the coordinate vectors.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>true_reference insert_element (size_type i, const_reference t)</code></td> | ||
|  | <td>Inserts the value <code>t</code> at the <code>i</code>-th | ||
|  | element. Duplicates elements are not allowed.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void append_element (size_type i, size_type j, const_reference t)</code></td> | ||
|  | <td>Appends the value <code>t</code> at the <code>i</code>-th element. | ||
|  | Duplicate elements can be appended to a <code>coordinate_vector</code>. They are merged into a single | ||
|  | arithmetically summed element by the <code>sort</code> function.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void erase_element (size_type i)</code></td> | ||
|  | <td>Erases the value at the <code>i</code>-th element.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>void clear ()</code></td> | ||
|  | <td>Clears the coordinate vector.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_iterator begin () const</code></td> | ||
|  | <td>Returns a <code>const_iterator</code> pointing to the beginning | ||
|  | of the <code>coordinate_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_iterator end () const</code></td> | ||
|  | <td>Returns a <code>const_iterator</code> pointing to the end of | ||
|  | the <code>coordinate_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>iterator begin ()</code></td> | ||
|  | <td>Returns a <code>iterator</code> pointing to the beginning of | ||
|  | the <code>coordinate_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>iterator end ()</code></td> | ||
|  | <td>Returns a <code>iterator</code> pointing to the end of the | ||
|  | <code>coordinate_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_reverse_iterator rbegin () const</code></td> | ||
|  | <td>Returns a <code>const_reverse_iterator</code> pointing to the | ||
|  | beginning of the reversed <code>coordinate_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>const_reverse_iterator rend () const</code></td> | ||
|  | <td>Returns a <code>const_reverse_iterator</code> pointing to the | ||
|  | end of the reversed <code>coordinate_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>reverse_iterator rbegin ()</code></td> | ||
|  | <td>Returns a <code>reverse_iterator</code> pointing to the | ||
|  | beginning of the reversed <code>coordinate_vector</code>.</td> | ||
|  | </tr> | ||
|  | <tr> | ||
|  | <td><code>reverse_iterator rend ()</code></td> | ||
|  | <td>Returns a <code>reverse_iterator</code> pointing to the end of | ||
|  | the reversed <code>coordinate_vector</code>.</td> | ||
|  | </tr> | ||
|  | </tbody> | ||
|  | </table> | ||
|  | <h4>Notes</h4> | ||
|  | <p><a name="coordinate_vector_1">[1]</a> | ||
|  | Supported parameters for the index base are <code>0</code> and | ||
|  | <code>1</code> at least.</p> | ||
|  | <p><a name="coordinate_vector_2">[2]</a> | ||
|  | Supported parameters for the adapted array are | ||
|  | <code>unbounded_array<></code> , | ||
|  | <code>bounded_array<></code> and | ||
|  | <code>std::vector<></code> .</p> | ||
|  | <hr /> | ||
|  | <p>Copyright (©) 2000-2002 Joerg Walter, Mathias Koch<br /> | ||
|  |    Use, modification and distribution are subject to the | ||
|  |    Boost Software License, Version 1.0. | ||
|  |    (See accompanying file LICENSE_1_0.txt | ||
|  |    or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"> | ||
|  |       http://www.boost.org/LICENSE_1_0.txt | ||
|  |    </a>). | ||
|  | </p> | ||
|  | <script type="text/javascript"> | ||
|  | (function($) { | ||
|  |     $('#toc').toc(); | ||
|  | })(jQuery); | ||
|  | </script> | ||
|  | </body> | ||
|  | </html> |