123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983 |
- <!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 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>
- <title>Sparse Matrix</title>
- </head>
- <body>
- <h1><img src="../../../../boost.png" align="middle" />Sparse Matricies</h1>
- <div class="toc" id="toc"></div>
- <h2><a name="mapped_matrix"></a>Mapped Matrix</h2>
- <h4>Description</h4>
- <p>The templated class <code>mapped_matrix<T, F, A></code> is
- the base container adaptor for sparse matricies using element maps.
- For a <em>(m xn</em>)-dimensional sparse matrix and <em>0 <= i < m</em>,
- <em>0 <= j < n</em> the non-zero elements
- <em>m</em><sub><em>i, j</em></sub> are mapped via <em>(i x n +
- j)</em> for row major orientation or via <em>(i + j x m)</em> for
- column major orientation to consecutive elements of the associative
- container, i.e. for elements <em>k</em> =
- <em>m</em><sub><em>i</em></sub><sub><sub><em>1</em></sub></sub><sub>
- <em>,j</em></sub><sub><sub><em>1</em></sub></sub>and <em>k + 1 =
- m</em><sub><em>i</em></sub><sub><sub><em>2</em></sub></sub><sub><em>
- ,j</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> or <em>(i</em><sub><em>1</em></sub>
- <em>= i</em><sub><em>2</em></sub> and
- <em>j</em><sub><em>1</em></sub> <em><
- j</em><sub><em>2</em></sub><em>)</em> with row major orientation or
- <em>j</em><sub><em>1</em></sub> <em><
- j</em><sub><em>2</em></sub> or <em>(j</em><sub><em>1</em></sub>
- <em>= j</em><sub><em>2</em></sub> and
- <em>i</em><sub><em>1</em></sub> <em><
- i</em><sub><em>2</em></sub><em>)</em> with column major
- orientation.</p>
- <h4>Example</h4>
- <pre>
- #include <boost/numeric/ublas/matrix_sparse.hpp>
- #include <boost/numeric/ublas/io.hpp>
- int main () {
- using namespace boost::numeric::ublas;
- mapped_matrix<double> m (3, 3, 3 * 3);
- for (unsigned i = 0; i < m.size1 (); ++ i)
- for (unsigned j = 0; j < m.size2 (); ++ j)
- m (i, j) = 3 * i + j;
- std::cout << m << std::endl;
- }
- </pre>
- <h4>Definition</h4>
- <p>Defined in the header matrix_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 matrix.</td>
- <td></td>
- </tr>
- <tr>
- <td><code>F</code></td>
- <td>Functor describing the storage organization. <a href=
- "#mapped_matrix_1">[1]</a></td>
- <td><code>row_major</code></td>
- </tr>
- <tr>
- <td><code>A</code></td>
- <td>The type of the adapted array. <a href=
- "#mapped_matrix_2">[2]</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#matrix">Matrix</a> .</p>
- <h4>Type requirements</h4>
- <p>None, except for those imposed by the requirements of <a href=
- "container_concept.html#matrix">Matrix</a> .</p>
- <h4>Public base classes</h4>
- <p><code>matrix_container<mapped_matrix<T, F, A>
- ></code></p>
- <h4>Members</h4>
- <table border="1" summary="members">
- <tbody>
- <tr>
- <th>Member</th>
- <th>Description</th>
- </tr>
- <tr>
- <td><code>mapped_matrix ()</code></td>
- <td>Allocates a <code>mapped_matrix</code> that holds at most zero
- rows of zero elements.</td>
- </tr>
- <tr>
- <td><code>mapped_matrix (size_type size1, size_type2, size_type non_zeros = 0)</code></td>
- <td>Allocates a <code>mapped_matrix</code> that holds at most
- <code>size1</code> rows of <code>size2</code> elements.</td>
- </tr>
- <tr>
- <td><code>mapped_matrix (const mapped_matrix &m)</code></td>
- <td>The copy constructor.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- mapped_matrix (size_type non_zeros, const
- matrix_expression<AE> &ae)</code></td>
- <td>The extended copy constructor.</td>
- </tr>
- <tr>
- <td><code>void resize (size_type size1, size_type size2, bool preserve = true)</code></td>
- <td>Reallocates a <code>mapped_matrix</code> to hold at most
- <code>size1</code> rows of <code>size2</code> elements. The
- existing elements of the <code>mapped_matrix</code> are preseved
- when specified.</td>
- </tr>
- <tr>
- <td><code>size_type size1 () const</code></td>
- <td>Returns the number of rows.</td>
- </tr>
- <tr>
- <td><code>size_type size2 () const</code></td>
- <td>Returns the number of columns.</td>
- </tr>
- <tr>
- <td><code>const_reference operator () (size_type i, size_type j)
- const</code></td>
- <td>Returns the value of the <code>j</code>-th element in the
- <code>i</code>-th row.</td>
- </tr>
- <tr>
- <td><code>reference operator () (size_type i, size_type
- j)</code></td>
- <td>Returns a reference of the <code>j</code>-th element in the
- <code>i</code>-th row.</td>
- </tr>
- <tr>
- <td><code>mapped_matrix &operator = (const mapped_matrix
- &m)</code></td>
- <td>The assignment operator.</td>
- </tr>
- <tr>
- <td><code>mapped_matrix &assign_temporary (mapped_matrix
- &m)</code></td>
- <td>Assigns a temporary. May change the mapped matrix
- <code>m</code> .</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- mapped_matrix &operator = (const matrix_expression<AE>
- &ae)</code></td>
- <td>The extended assignment operator.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- mapped_matrix &assign (const matrix_expression<AE>
- &ae)</code></td>
- <td>Assigns a matrix expression to the mapped matrix. Left and
- right hand side of the assignment should be independent.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- mapped_matrix &operator += (const matrix_expression<AE>
- &ae)</code></td>
- <td>A computed assignment operator. Adds the matrix expression to
- the mapped matrix.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- mapped_matrix &plus_assign (const matrix_expression<AE>
- &ae)</code></td>
- <td>Adds a matrix expression to the mapped matrix. Left and right
- hand side of the assignment should be independent.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- mapped_matrix &operator -= (const matrix_expression<AE>
- &ae)</code></td>
- <td>A computed assignment operator. Subtracts the matrix expression
- from the mapped matrix.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- mapped_matrix &minus_assign (const matrix_expression<AE>
- &ae)</code></td>
- <td>Subtracts a matrix expression from the mapped matrix. Left and
- right hand side of the assignment should be independent.</td>
- </tr>
- <tr>
- <td><code>template<class AT><br />
- mapped_matrix &operator *= (const AT &at)</code></td>
- <td>A computed assignment operator. Multiplies the mapped matrix
- with a scalar.</td>
- </tr>
- <tr>
- <td><code>template<class AT><br />
- mapped_matrix &operator /= (const AT &at)</code></td>
- <td>A computed assignment operator. Divides the mapped matrix
- through a scalar.</td>
- </tr>
- <tr>
- <td><code>void swap (mapped_matrix &m)</code></td>
- <td>Swaps the contents of the mapped matrices.</td>
- </tr>
- <tr>
- <td><code>true_refrence insert_element (size_type i, size_type j, const_reference
- t)</code></td>
- <td>Inserts the value <code>t</code> at the <code>j</code>-th
- element of the <code>i</code>-th row. Duplicates elements are not allowed.</td>
- </tr>
- <tr>
- <td><code>void erase_element (size_type i, size_type j)</code></td>
- <td>Erases the value at the <code>j</code>-th element of the
- <code>i</code>-th row.</td>
- </tr>
- <tr>
- <td><code>void clear ()</code></td>
- <td>Clears the mapped matrix.</td>
- </tr>
- <tr>
- <td><code>const_iterator1 begin1 () const</code></td>
- <td>Returns a <code>const_iterator1</code> pointing to the
- beginning of the <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_iterator1 end1 () const</code></td>
- <td>Returns a <code>const_iterator1</code> pointing to the end of
- the <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>iterator1 begin1 ()</code></td>
- <td>Returns a <code>iterator1</code> pointing to the beginning of
- the <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>iterator1 end1 ()</code></td>
- <td>Returns a <code>iterator1</code> pointing to the end of the
- <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_iterator2 begin2 () const</code></td>
- <td>Returns a <code>const_iterator2</code> pointing to the
- beginning of the <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_iterator2 end2 () const</code></td>
- <td>Returns a <code>const_iterator2</code> pointing to the end of
- the <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>iterator2 begin2 ()</code></td>
- <td>Returns a <code>iterator2</code> pointing to the beginning of
- the <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>iterator2 end2 ()</code></td>
- <td>Returns a <code>iterator2</code> pointing to the end of the
- <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_reverse_iterator1 rbegin1 () const</code></td>
- <td>Returns a <code>const_reverse_iterator1</code> pointing to the
- beginning of the reversed <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_reverse_iterator1 rend1 () const</code></td>
- <td>Returns a <code>const_reverse_iterator1</code> pointing to the
- end of the reversed <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>reverse_iterator1 rbegin1 ()</code></td>
- <td>Returns a <code>reverse_iterator1</code> pointing to the
- beginning of the reversed <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>reverse_iterator1 rend1 ()</code></td>
- <td>Returns a <code>reverse_iterator1</code> pointing to the end of
- the reversed <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_reverse_iterator2 rbegin2 () const</code></td>
- <td>Returns a <code>const_reverse_iterator2</code> pointing to the
- beginning of the reversed <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_reverse_iterator2 rend2 () const</code></td>
- <td>Returns a <code>const_reverse_iterator2</code> pointing to the
- end of the reversed <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>reverse_iterator2 rbegin2 ()</code></td>
- <td>Returns a <code>reverse_iterator2</code> pointing to the
- beginning of the reversed <code>mapped_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>reverse_iterator2 rend2 ()</code></td>
- <td>Returns a <code>reverse_iterator2</code> pointing to the end of
- the reversed <code>mapped_matrix</code>.</td>
- </tr>
- </tbody>
- </table>
- <h4>Notes</h4>
- <p><a name="mapped_matrix_1">[1]</a> Supported
- parameters for the storage organization are <code>row_major</code>
- and <code>column_major</code>.</p>
- <p><a name="mapped_matrix_2">[2]</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_matrix"></a>Compressed Matrix</h2>
- <h4>Description</h4>
- <p>The templated class <code>compressed_matrix<T, F, IB, IA,
- TA></code> is the base container adaptor for compressed
- matrices. For a <em>(m x n</em> )-dimensional compressed matrix and
- <em>0 <= i < m</em>, <em>0 <= j < n</em> the non-zero
- elements <em>m</em><sub><em>i, j</em></sub> are mapped via <em>(i x
- n + j)</em> for row major orientation or via <em>(i + j x m)</em>
- for column major orientation to consecutive elements of the index
- and value containers, i.e. for elements <em>k</em> =
- <em>m</em><sub><em>i</em></sub><sub><sub><em>1</em></sub></sub><sub>
- <em>,j</em></sub><sub><sub><em>1</em></sub></sub>and <em>k + 1 =
- m</em><sub><em>i</em></sub><sub><sub><em>2</em></sub></sub><sub><em>
- ,j</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> or <em>(i</em><sub><em>1</em></sub>
- <em>= i</em><sub><em>2</em></sub> and
- <em>j</em><sub><em>1</em></sub> <em><
- j</em><sub><em>2</em></sub><em>)</em> with row major orientation or
- <em>j</em><sub><em>1</em></sub> <em><
- j</em><sub><em>2</em></sub> or <em>(j</em><sub><em>1</em></sub>
- <em>= j</em><sub><em>2</em></sub> and
- <em>i</em><sub><em>1</em></sub> <em><
- i</em><sub><em>2</em></sub><em>)</em> with column major
- orientation.</p>
- <h4>Example</h4>
- <pre>
- #include <boost/numeric/ublas/matrix_sparse.hpp>
- #include <boost/numeric/ublas/io.hpp>
- int main () {
- using namespace boost::numeric::ublas;
- compressed_matrix<double> m (3, 3, 3 * 3);
- for (unsigned i = 0; i < m.size1 (); ++ i)
- for (unsigned j = 0; j < m.size2 (); ++ j)
- m (i, j) = 3 * i + j;
- std::cout << m << std::endl;
- }
- </pre>
- <h4>Definition</h4>
- <p>Defined in the header matrix_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 matrix.</td>
- <td></td>
- </tr>
- <tr>
- <td><code>F</code></td>
- <td>Functor describing the storage organization. <a href=
- "#compressed_matrix_1">[1]</a></td>
- <td><code>row_major</code></td>
- </tr>
- <tr>
- <td><code>IB</code></td>
- <td>The index base of the compressed vector. <a href=
- "#compressed_matrix_2">[2]</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_matrix_3">[3]</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_matrix_3">[3]</a></td>
- <td><code>unbounded_array<T></code></td>
- </tr>
- </tbody>
- </table>
- <h4>Model of</h4>
- <p><a href="container_concept.html#matrix">Matrix</a> .</p>
- <h4>Type requirements</h4>
- <p>None, except for those imposed by the requirements of <a href=
- "container_concept.html#matrix">Matrix</a> .</p>
- <h4>Public base classes</h4>
- <p><code>matrix_container<compressed_matrix<T, F, 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_matrix ()</code></td>
- <td>Allocates a <code>compressed_matrix</code> that holds at most
- zero rows of zero elements.</td>
- </tr>
- <tr>
- <td><code>compressed_matrix (size_type size1, size_type2, size_type non_zeros = 0)</code></td>
- <td>Allocates a <code>compressed_matrix</code> that holds at most
- <code>size1</code> rows of <code>size2</code> elements.</td>
- </tr>
- <tr>
- <td><code>compressed_matrix (const compressed_matrix
- &m)</code></td>
- <td>The copy constructor.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- compressed_matrix (size_type non_zeros, const
- matrix_expression<AE> &ae)</code></td>
- <td>The extended copy constructor.</td>
- </tr>
- <tr>
- <td><code>void resize (size_type size1, size_type size2, bool preserve = true)</code></td>
- <td>Reallocates a <code>compressed_matrix</code> to hold at most
- <code>size1</code> rows of <code>size2</code> elements. The
- existing elements of the <code>compressed_matrix</code> are
- preseved when specified.</td>
- </tr>
- <tr>
- <td><code>size_type size1 () const</code></td>
- <td>Returns the number of rows.</td>
- </tr>
- <tr>
- <td><code>size_type size2 () const</code></td>
- <td>Returns the number of columns.</td>
- </tr>
- <tr>
- <td><code>const_reference operator () (size_type i, size_type j)
- const</code></td>
- <td>Returns the value of the <code>j</code>-th element in the
- <code>i</code>-th row.</td>
- </tr>
- <tr>
- <td><code>reference operator () (size_type i, size_type
- j)</code></td>
- <td>Returns a reference of the <code>j</code>-th element in the
- <code>i</code>-th row.</td>
- </tr>
- <tr>
- <td><code>compressed_matrix &operator = (const
- compressed_matrix &m)</code></td>
- <td>The assignment operator.</td>
- </tr>
- <tr>
- <td><code>compressed_matrix &assign_temporary
- (compressed_matrix &m)</code></td>
- <td>Assigns a temporary. May change the compressed matrix
- <code>m</code>.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- compressed_matrix &operator = (const
- matrix_expression<AE> &ae)</code></td>
- <td>The extended assignment operator.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- compressed_matrix &assign (const matrix_expression<AE>
- &ae)</code></td>
- <td>Assigns a matrix expression to the compressed matrix. Left and
- right hand side of the assignment should be independent.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- compressed_matrix &operator += (const
- matrix_expression<AE> &ae)</code></td>
- <td>A computed assignment operator. Adds the matrix expression to
- the compressed matrix.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- compressed_matrix &plus_assign (const
- matrix_expression<AE> &ae)</code></td>
- <td>Adds a matrix expression to the compressed matrix. Left and
- right hand side of the assignment should be independent.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- compressed_matrix &operator -= (const
- matrix_expression<AE> &ae)</code></td>
- <td>A computed assignment operator. Subtracts the matrix expression
- from the compressed matrix.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- compressed_matrix &minus_assign (const
- matrix_expression<AE> &ae)</code></td>
- <td>Subtracts a matrix expression from the compressed matrix. Left
- and right hand side of the assignment should be independent.</td>
- </tr>
- <tr>
- <td><code>template<class AT><br />
- compressed_matrix &operator *= (const AT &at)</code></td>
- <td>A computed assignment operator. Multiplies the compressed
- matrix with a scalar.</td>
- </tr>
- <tr>
- <td><code>template<class AT><br />
- compressed_matrix &operator /= (const AT &at)</code></td>
- <td>A computed assignment operator. Divides the compressed matrix
- through a scalar.</td>
- </tr>
- <tr>
- <td><code>void swap (compressed_matrix &m)</code></td>
- <td>Swaps the contents of the compressed matrices.</td>
- </tr>
- <tr>
- <td><code>true_reference insert_element (size_type i, size_type j, const_reference
- t)</code></td>
- <td>Inserts the value <code>t</code> at the <code>j</code>-th
- element of the <code>i</code>-th row. Duplicates elements are not allowed.</td>
- </tr>
- <tr>
- <td><code>void erase_element (size_type i, size_type j)</code></td>
- <td>Erases the value at the <code>j</code>-th element of the
- <code>i</code>-th row.</td>
- </tr>
- <tr>
- <td><code>void clear ()</code></td>
- <td>Clears the compressed matrix.</td>
- </tr>
- <tr>
- <td><code>const_iterator1 begin1 () const</code></td>
- <td>Returns a <code>const_iterator1</code> pointing to the
- beginning of the <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_iterator1 end1 () const</code></td>
- <td>Returns a <code>const_iterator1</code> pointing to the end of
- the <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>iterator1 begin1 ()</code></td>
- <td>Returns a <code>iterator1</code> pointing to the beginning of
- the <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>iterator1 end1 ()</code></td>
- <td>Returns a <code>iterator1</code> pointing to the end of the
- <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_iterator2 begin2 () const</code></td>
- <td>Returns a <code>const_iterator2</code> pointing to the
- beginning of the <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_iterator2 end2 () const</code></td>
- <td>Returns a <code>const_iterator2</code> pointing to the end of
- the <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>iterator2 begin2 ()</code></td>
- <td>Returns a <code>iterator2</code> pointing to the beginning of
- the <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>iterator2 end2 ()</code></td>
- <td>Returns a <code>iterator2</code> pointing to the end of the
- <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_reverse_iterator1 rbegin1 () const</code></td>
- <td>Returns a <code>const_reverse_iterator1</code> pointing to the
- beginning of the reversed <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_reverse_iterator1 rend1 () const</code></td>
- <td>Returns a <code>const_reverse_iterator1</code> pointing to the
- end of the reversed <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>reverse_iterator1 rbegin1 ()</code></td>
- <td>Returns a <code>reverse_iterator1</code> pointing to the
- beginning of the reversed <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>reverse_iterator1 rend1 ()</code></td>
- <td>Returns a <code>reverse_iterator1</code> pointing to the end of
- the reversed <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_reverse_iterator2 rbegin2 () const</code></td>
- <td>Returns a <code>const_reverse_iterator2</code> pointing to the
- beginning of the reversed <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_reverse_iterator2 rend2 () const</code></td>
- <td>Returns a <code>const_reverse_iterator2</code> pointing to the
- end of the reversed <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>reverse_iterator2 rbegin2 ()</code></td>
- <td>Returns a <code>reverse_iterator2</code> pointing to the
- beginning of the reversed <code>compressed_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>reverse_iterator2 rend2 ()</code></td>
- <td>Returns a <code>reverse_iterator2</code> pointing to the end of
- the reversed <code>compressed_matrix</code>.</td>
- </tr>
- </tbody>
- </table>
- <h4>Notes</h4>
- <p><a name="compressed_matrix_1">[1]</a>
- Supported parameters for the storage organization are
- <code>row_major</code> and <code>column_major</code>.</p>
- <p><a name="compressed_matrix_2">[2]</a>
- Supported parameters for the index base are <code>0</code> and
- <code>1</code> at least.</p>
- <p><a name="compressed_matrix_3">[3]</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_matrix"></a>Coordinate Matrix</h2>
- <h4>Description</h4>
- <p>The templated class <code>coordinate_matrix<T, F, IB, IA,
- TA></code> is the base container adaptor for compressed
- matrices. For a <em>(m x n</em> )-dimensional sorted coordinate
- matrix and <em>0 <= i < m</em>, <em>0 <= j < n</em> the
- non-zero elements <em>m</em><sub><em>i, j</em></sub> are mapped via
- <em>(i x n + j)</em> for row major orientation or via <em>(i + j x
- m)</em> for column major orientation to consecutive elements of the
- index and value containers, i.e. for elements <em>k</em> =
- <em>m</em><sub><em>i</em></sub><sub><sub><em>1</em></sub></sub><sub>
- <em>,j</em></sub><sub><sub><em>1</em></sub></sub>and <em>k + 1 =
- m</em><sub><em>i</em></sub><sub><sub><em>2</em></sub></sub><sub><em>
- ,j</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> or <em>(i</em><sub><em>1</em></sub>
- <em>= i</em><sub><em>2</em></sub> and
- <em>j</em><sub><em>1</em></sub> <em><
- j</em><sub><em>2</em></sub><em>)</em> with row major orientation or
- <em>j</em><sub><em>1</em></sub> <em><
- j</em><sub><em>2</em></sub> or <em>(j</em><sub><em>1</em></sub>
- <em>= j</em><sub><em>2</em></sub> and
- <em>i</em><sub><em>1</em></sub> <em><
- i</em><sub><em>2</em></sub><em>)</em> with column major
- orientation.</p>
- <h4>Example</h4>
- <pre>
- #include <boost/numeric/ublas/matrix_sparse.hpp>
- #include <boost/numeric/ublas/io.hpp>
- int main () {
- using namespace boost::numeric::ublas;
- coordinate_matrix<double> m (3, 3, 3 * 3);
- for (unsigned i = 0; i < m.size1 (); ++ i)
- for (unsigned j = 0; j < m.size2 (); ++ j)
- m (i, j) = 3 * i + j;
- std::cout << m << std::endl;
- }
- </pre>
- <h4>Definition</h4>
- <p>Defined in the header matrix_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 matrix.</td>
- <td></td>
- </tr>
- <tr>
- <td><code>F</code></td>
- <td>Functor describing the storage organization. <a href=
- "#coordinate_matrix_1">[1]</a></td>
- <td><code>row_major</code></td>
- </tr>
- <tr>
- <td><code>IB</code></td>
- <td>The index base of the coordinate vector. <a href=
- "#coordinate_matrix_2">[2]</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_matrix_3">[3]</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_matrix_3">[3]</a></td>
- <td><code>unbounded_array<T></code></td>
- </tr>
- </tbody>
- </table>
- <h4>Model of</h4>
- <p><a href="container_concept.html#matrix">Matrix</a> .</p>
- <h4>Type requirements</h4>
- <p>None, except for those imposed by the requirements of <a href=
- "container_concept.html#matrix">Matrix</a> .</p>
- <h4>Public base classes</h4>
- <p><code>matrix_container<coordinate_matrix<T, F, 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_matrix ()</code></td>
- <td>Allocates a <code>coordinate_matrix</code> that holds at most
- zero rows of zero elements.</td>
- </tr>
- <tr>
- <td><code>coordinate_matrix (size_type size1, size_type2, size_type non_zeros = 0)</code></td>
- <td>Allocates a <code>coordinate_matrix</code> that holds at most
- <code>size1</code> rows of <code>size2</code> elements.</td>
- </tr>
- <tr>
- <td><code>coordinate_matrix (const coordinate_matrix
- &m)</code></td>
- <td>The copy constructor.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- coordinate_matrix (size_type non_zeros, const
- matrix_expression<AE> &ae)</code></td>
- <td>The extended copy constructor.</td>
- </tr>
- <tr>
- <td><code>void resize (size_type size1, size_type size2, bool preserve = true)</code></td>
- <td>Reallocates a <code>coordinate_matrix</code> to hold at most
- <code>size1</code> rows of <code>size2</code> elements. The
- existing elements of the <code>coordinate_matrix</code> are
- preseved when specified.</td>
- </tr>
- <tr>
- <td><code>size_type size1 () const</code></td>
- <td>Returns the number of rows.</td>
- </tr>
- <tr>
- <td><code>size_type size2 () const</code></td>
- <td>Returns the number of columns.</td>
- </tr>
- <tr>
- <td><code>const_reference operator () (size_type i, size_type j)
- const</code></td>
- <td>Returns the value of the <code>j</code>-th element in the
- <code>i</code>-th row.</td>
- </tr>
- <tr>
- <td><code>reference operator () (size_type i, size_type
- j)</code></td>
- <td>Returns a reference of the <code>j</code>-th element in the
- <code>i</code>-th row.</td>
- </tr>
- <tr>
- <td><code>coordinate_matrix &operator = (const
- coordinate_matrix &m)</code></td>
- <td>The assignment operator.</td>
- </tr>
- <tr>
- <td><code>coordinate_matrix &assign_temporary
- (coordinate_matrix &m)</code></td>
- <td>Assigns a temporary. May change the coordinate matrix
- <code>m</code>.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- coordinate_matrix &operator = (const
- matrix_expression<AE> &ae)</code></td>
- <td>The extended assignment operator.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- coordinate_matrix &assign (const matrix_expression<AE>
- &ae)</code></td>
- <td>Assigns a matrix expression to the coordinate matrix. Left and
- right hand side of the assignment should be independent.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- coordinate_matrix &operator += (const
- matrix_expression<AE> &ae)</code></td>
- <td>A computed assignment operator. Adds the matrix expression to
- the coordinate matrix.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- coordinate_matrix &plus_assign (const
- matrix_expression<AE> &ae)</code></td>
- <td>Adds a matrix expression to the coordinate matrix. Left and
- right hand side of the assignment should be independent.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- coordinate_matrix &operator -= (const
- matrix_expression<AE> &ae)</code></td>
- <td>A computed assignment operator. Subtracts the matrix expression
- from the coordinate matrix.</td>
- </tr>
- <tr>
- <td><code>template<class AE><br />
- coordinate_matrix &minus_assign (const
- matrix_expression<AE> &ae)</code></td>
- <td>Subtracts a matrix expression from the coordinate matrix. Left
- and right hand side of the assignment should be independent.</td>
- </tr>
- <tr>
- <td><code>template<class AT><br />
- coordinate_matrix &operator *= (const AT &at)</code></td>
- <td>A computed assignment operator. Multiplies the coordinate
- matrix with a scalar.</td>
- </tr>
- <tr>
- <td><code>template<class AT><br />
- coordinate_matrix &operator /= (const AT &at)</code></td>
- <td>A computed assignment operator. Divides the coordinate matrix
- through a scalar.</td>
- </tr>
- <tr>
- <td><code>void swap (coordinate_matrix &m)</code></td>
- <td>Swaps the contents of the coordinate matrices.</td>
- </tr>
- <tr>
- <td><code>true_reference insert_element (size_type i, size_type j, const_reference
- t)</code></td>
- <td>Inserts the value <code>t</code> at the <code>j</code>-th
- element of the <code>i</code>-th row. 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>j</code>-th element of the <code>i</code>-th row.
- Duplicate elements can be appended to a <code>coordinate_matrix</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, size_type j)</code></td>
- <td>Erases the value at the <code>j</code>-th element of the
- <code>i</code>-th row.</td>
- </tr>
- <tr>
- <td><code>void clear ()</code></td>
- <td>Clears the coordinate matrix.</td>
- </tr>
- <tr>
- <td><code>const_iterator1 begin1 () const</code></td>
- <td>Returns a <code>const_iterator1</code> pointing to the
- beginning of the <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_iterator1 end1 () const</code></td>
- <td>Returns a <code>const_iterator1</code> pointing to the end of
- the <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>iterator1 begin1 ()</code></td>
- <td>Returns a <code>iterator1</code> pointing to the beginning of
- the <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>iterator1 end1 ()</code></td>
- <td>Returns a <code>iterator1</code> pointing to the end of the
- <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_iterator2 begin2 () const</code></td>
- <td>Returns a <code>const_iterator2</code> pointing to the
- beginning of the <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_iterator2 end2 () const</code></td>
- <td>Returns a <code>const_iterator2</code> pointing to the end of
- the <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>iterator2 begin2 ()</code></td>
- <td>Returns a <code>iterator2</code> pointing to the beginning of
- the <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>iterator2 end2 ()</code></td>
- <td>Returns a <code>iterator2</code> pointing to the end of the
- <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_reverse_iterator1 rbegin1 () const</code></td>
- <td>Returns a <code>const_reverse_iterator1</code> pointing to the
- beginning of the reversed <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_reverse_iterator1 rend1 () const</code></td>
- <td>Returns a <code>const_reverse_iterator1</code> pointing to the
- end of the reversed <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>reverse_iterator1 rbegin1 ()</code></td>
- <td>Returns a <code>reverse_iterator1</code> pointing to the
- beginning of the reversed <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>reverse_iterator1 rend1 ()</code></td>
- <td>Returns a <code>reverse_iterator1</code> pointing to the end of
- the reversed <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_reverse_iterator2 rbegin2 () const</code></td>
- <td>Returns a <code>const_reverse_iterator2</code> pointing to the
- beginning of the reversed <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>const_reverse_iterator2 rend2 () const</code></td>
- <td>Returns a <code>const_reverse_iterator2</code> pointing to the
- end of the reversed <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>reverse_iterator2 rbegin2 ()</code></td>
- <td>Returns a <code>reverse_iterator2</code> pointing to the
- beginning of the reversed <code>coordinate_matrix</code>.</td>
- </tr>
- <tr>
- <td><code>reverse_iterator2 rend2 ()</code></td>
- <td>Returns a <code>reverse_iterator2</code> pointing to the end of
- the reversed <code>coordinate_matrix</code>.</td>
- </tr>
- </tbody>
- </table>
- <h4>Notes</h4>
- <p><a name="coordinate_matrix_1">[1]</a>
- Supported parameters for the storage organization are
- <code>row_major</code> and <code>column_major</code>.</p>
- <p><a name="coordinate_matrix_2">[2]</a>
- Supported parameters for the index base are <code>0</code> and
- <code>1</code> at least.</p>
- <p><a name="coordinate_matrix_3">[3]</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>
|