123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608 |
- <!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 name="GENERATOR" content="Quanta Plus" />
- <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>Types Overview</title>
- </head>
- <body>
- <h1><img src="../../../../boost.png" align="middle" />Overview of Tensor, Matrix- and Vector Types </h1>
- <div class="toc" id="toc"></div>
- <dl>
- <dt>Contents:</dt>
- <dd><a href="#vectors">Vectors</a></dd>
- <dd><a href="#vector_proxies">Vector Proxies</a></dd>
- <dd><a href="#matrices">Matrices</a></dd>
- <dd><a href="#matrix_proxies">Matrix Proxies</a></dd>
- <dd><a href="#tensors">Tensors</a></dd>
- <dd><a href="#storage_layout">Special Storage Layouts</a></dd>
- </dl>
- <h2>Notation</h2>
- <table style="border: none;" summary="notation">
- <tr><td><code>T</code></td>
- <td>is the data type. For general linear algebra operations this will be a real type e.g. <code>double</code>, ...</td></tr>
- <tr><td><code>F</code></td>
- <td>is the orientation type, either
- <code>row_major</code> or <code>column_major</code> for matrices and <code>first_order</code> or <code>last_order</code> for tensors</td></tr>
- <tr><td><code>A, IA, TA</code></td> <td>is an array storage type, e.g. <code>std::vector,
- bounded_array, unbounded_array, ...</code></td></tr>
- <tr><td><code>TRI</code></td>
- <td>is a triangular functor: <code>lower,
- unit_lower, strict_lower, upper, unit_upper,
- strict_upper</code></td></tr>
- <tr><td><code>M, N, K</code></td>
- <td>are unsigned integer sizes
- (<code>std::size_t</code>)</td></tr>
- <tr><td><code>IB</code></td>
- <td>is an index base
- (<code>std::size_t</code>)</td></tr>
- <tr><td><code>VEC</code></td>
- <td>is any vector type</td></tr>
- <tr><td><code>MAT</code> </td>
- <td>is any matrix type</td></tr>
- <tr><td><code>TEN</code> </td>
- <td>is any tensor type</td></tr>
- <tr><td><code>[...]</code></td>
- <td>denote optional arguments - for more details
- look at the section "storage layout".</td></tr>
- </table>
- <h2><a id="vectors">Vectors</a></h2>
- <table border="1" summary="vector types">
- <thead>
- <tr>
- <th width="30%">Definition</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>vector<T [, A]><br /> v(size);</code></td>
- <td>a dense vector of values of type <code>T</code> of variable
- size. A storage type <code>A</code> can be specified
- which defaults to <code>unbounded_array</code>.
- Elements are constructed by <code>A</code>, which need not initialise their value.</td>
- </tr>
- <tr>
- <td><code>bounded_vector<T, N><br /> v;</code></td>
- <td>a dense vector of values of type <code>T</code> of variable size but with maximum
- <code>N</code>. The default constructor creates <code>v</code>
- with size <code>N</code>.
- Elements are constructed by the storage type <code>bounded_array</code>, which need not initialise their value.</td>
- </tr>
- <tr>
- <td><code>c_vector<T, M><br /> v(size);</code></td>
- <td>a dense vector of values of type <code>T</code> with the given size.
- The data is stored as an ordinary C++ array <code>T
- data_[M]</code></td>
- </tr>
- <tr>
- <td><code>zero_vector<T><br /> v(size);</code></td>
- <td>the zero vector of type <code>T</code> with the given
- size.</td>
- </tr>
- <tr>
- <td><code>unit_vector<T><br /> v(size, index);</code></td>
- <td>the unit vector of type <code>T</code> with the given size. The
- vector is zero other then a single specified element.
- <br/><code>index</code> should be less than <code>size</code>.</td>
- </tr>
- <tr>
- <td><code>mapped_vector<T [, S]><br /> v(size);</code></td>
- <td>a sparse vector of values of type <code>T</code> of variable
- size. The sparse storage type <code>S</code> can be <code>std::map<size_t,
- T></code> or <code>map_array<size_t, T></code>.</td>
- </tr>
- <tr>
- <td><code>compressed_vector<T [,IB, IA, TA]><br /> v(size);</code></td>
- <td>a sparse vector of values of type <code>T</code> of variable
- size. The non zero values are stored as two seperate arrays - an
- index array and a value array. The index array is always sorted and
- there is at most one entry for each index.</td>
- </tr>
- <tr>
- <td><code>coordinate_vector<T [,IB, IA, TA]><br /> v(size);</code></td>
- <td>a sparse vector of values of type <code>T</code> of variable
- size. The non zero values are stored as two seperate arrays - an
- index array and a value array. The arrays may be out of order with
- multiple entries for each vector element. If there are multiple
- values for the same index the sum of these values is the real
- value.</td>
- </tr>
- </tbody>
- </table>
- <p><em>Note:</em> the default types are defined in
- <code>boost/numeric/ublas/fwd.hpp</code>.</p>
- <h2><a id="vector_proxies">Vector Proxies</a></h2>
- <table border="1" summary="vector proxies">
- <thead>
- <tr>
- <th width="30%">Definition</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>vector_range<VEC><br /> vr(v, range);</code></td>
- <td>a vector referencing a continuous subvector of elements of
- vector <code>v</code> containing all elements specified by
- <code>range</code>.</td>
- </tr>
- <tr>
- <td><code>vector_slice<VEC><br /> vs(v, slice);</code></td>
- <td>a vector referencing a non continuous subvector of elements of
- vector <code>v</code> containing all elements specified by
- <code>slice</code>.</td>
- </tr>
- <tr>
- <td><code>matrix_row<MAT><br /> vr(m, index);</code></td>
- <td>a vector referencing the <code>index</code>-th row of matrix
- <code>m</code></td>
- </tr>
- <tr>
- <td><code>matrix_column<MAT><br /> vc(m, index);</code></td>
- <td>a vector referencing the <code>index</code>-th column of matrix
- <code>m</code></td>
- </tr>
- </tbody>
- </table>
- <h2><a id="matrices">Matrices</a></h2>
- <table border="1" summary="matrix types">
- <thead>
- <tr>
- <th width="30%">Definition</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>matrix<T [, F, A]><br /> m(size1, size2);</code></td>
- <td>a dense matrix of values of type <code>T</code> of variable
- size. A storage type <code>A</code> can be specified
- which defaults to <code>unbounded_array</code>.
- The orientation functor <code>F</code> defaults to
- <code>row_major</code>.
- Elements are constructed by <code>A</code>, which need not initialise their value.</td>
- </tr>
- <tr>
- <td><code>bounded_matrix<T, M, N [, F]><br /> m;</code></td>
- <td>a dense matrix of type <code>T</code> with variable size with maximum <code>M</code>-by-<code>N</code>. The orientation functor <code>F</code>
- defaults to <code>row_major</code>. The default constructor creates
- <code>m</code> with size <code>M</code>-by-<code>N</code>.
- Elements are constructed by the storage type <code>bounded_array</code>, which need not initialise their value.</td>
- </tr>
- <tr>
- <td><code>c_matrix<T, M, N><br /> m(size1, size2);</code></td>
- <td>a dense matrix of values of type <code>T</code> with the given size.
- The data is stored as an ordinary C++ array <code>T
- data_[N][M]</code></td>
- </tr>
- <tr>
- <td><code>vector_of_vector<T [, F, A]><br /> m(size1,
- size2);</code></td>
- <td>a dense matrix of values of type <code>T</code> with the given size.
- The data is stored as a vector of vectors. The orientation
- <code>F</code> defaults to <code>row_major</code>. The storage
- type <code>S</code> defaults to
- <code>unbounded_array<unbounded_array<T> ></code></td>
- </tr>
- <tr>
- <td><code>zero_matrix<T><br /> m(size1, size2);</code></td>
- <td>a zero matrix of type <code>T</code> with the given size.</td>
- </tr>
- <tr>
- <td><code>identity_matrix<T><br /> m(size1, size2);</code></td>
- <td>an identity matrix of type <code>T</code> with the given size.
- The values are <code>v(i,j) = (i==j)?T(1):T()</code>.</td>
- </tr>
- <tr>
- <td><code>scalar_matrix<T><br /> m(size1, size2,
- value);</code></td>
- <td>a matrix of type <code>T</code> with the given size that has the
- value <code>value</code> everywhere.</td>
- </tr>
- <tr>
- <td><code>triangular_matrix<T [, TRI, F, A]><br />
- m(size);</code></td>
- <td>a triangular matrix of values of type <code>T</code> of
- variable size. Only the nonzero elements are stored in the given
- order <code>F</code>. ("triangular packed storage") The triangular
- type <code>F</code> defaults to <code>lower</code>, the orientation
- type <code>F</code> defaults to <code>row_major</code>.</td>
- </tr>
- <tr>
- <td><code>banded_matrix<T [, F, A]><br /> m(size1, size2, n_lower,
- n_upper);</code></td>
- <td>a banded matrix of values of type <code>T</code> of variable
- size with <code>n_lower</code> sub diagonals and
- <code>n_upper</code> super diagonals. Only the nonzero elements are
- stored in the given order <code>F</code>. ("packed storage")</td>
- </tr>
- <tr>
- <td><code>symmetric_matrix<T [, TRI, F, A]><br />
- m(size);</code></td>
- <td>a symmetric matrix of values of type <code>T</code> of
- variable size. Only the given triangular matrix is stored in the
- given order <code>F</code>.</td>
- </tr>
- <tr>
- <td><code>hermitian_matrix<T [, TRI, F, A]><br />
- m(size);</code></td>
- <td>a hermitian matrix of values of type <code>T</code> of
- variable size. Only the given triangular matrix is stored using
- the order <code>F</code>.</td>
- </tr>
- <tr>
- <td><code>mapped_matrix<T, [F, S]><br /> m(size1, size2 [,
- non_zeros]);</code></td>
- <td>a sparse matrix of values of type <code>T</code> of variable
- size. The sparse storage type <code>S</code> can be either <code>std::map<size_t,
- std::map<size_t, T> ></code> or
- <code>map_array<size_t, map_array<size_t,
- T> ></code>.</td>
- </tr>
- <tr>
- <td><code>sparse_vector_of_sparse_vector<T, [F, C]><br /> m(size1,
- size2 [, non_zeros]);</code></td>
- <td>a sparse matrix of values of type <code>T</code> of variable
- size.</td>
- </tr>
- <tr>
- <td><code>compressed_matrix<T, [F, IB, IA, TA]><br /> m(size1,
- size2 [, non_zeros]);</code></td>
- <td>a sparse matrix of values of type <code>T</code> of variable
- size. The values are stored in compressed row/column storage.</td>
- </tr>
- <tr>
- <td><code>coordinate_matrix<T, [F, IB, IA, TA]><br /> m(size1,
- size2 [, non_zeros]);</code></td>
- <td>a sparse matrix of values of type <code>T</code> of variable
- size. The values are stored in 3 parallel array as triples (i, j,
- value). More than one value for each pair of indices is possible,
- the real value is the sum of all.</td>
- </tr>
- <tr>
- <td><code>generalized_vector_of_vector<T, F, A><br /> m(size1,
- size2 [, non_zeros]);</code></td>
- <td>a sparse matrix of values of type <code>T</code> of variable
- size. The values are stored as a vector of sparse vectors, e.g.
- <code>generalized_vector_of_vector<double, row_major,
- unbounded_array<coordinate_vector<double> > ></code></td>
- </tr>
- </tbody>
- </table>
- <p><em>Note:</em> the default types are defined in
- <code>boost/numeric/ublas/fwd.hpp</code>.</p>
- <h2><a id="matrix_proxies">Matrix Proxies</a></h2>
- <table border="1" summary="matrix proxies">
- <thead>
- <tr>
- <th width="30%">Definition</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>triangular_adaptor<MAT, TRI><br /> ta(m);</code></td>
- <td>a triangular matrix referencing a selection of elements of the
- matrix <code>m</code>.</td>
- </tr>
- <tr>
- <td><code>symmetric_adaptor<MAT, TRI><br /> sa(m);</code></td>
- <td>a symmetric matrix referencing a selection of elements of the
- matrix <code>m</code>.</td>
- </tr>
- <tr>
- <td><code>hermitian_adaptor<MAT, TRI><br /> ha(m);</code></td>
- <td>a hermitian matrix referencing a selection of elements of the
- matrix <code>m</code>.</td>
- </tr>
- <tr>
- <td><code>banded_adaptor<MAT><br /> ba(m, n_lower,
- n_upper);</code></td>
- <td>a banded matrix referencing a selection of elements of the
- matrix <code>m</code>.</td>
- </tr>
- <tr>
- <td><code>matrix_range<MAT, TRI><br /> mr(m, range1,
- range2);</code></td>
- <td>a matrix referencing a submatrix of elements in the matrix
- <code>m</code>.</td>
- </tr>
- <tr>
- <td><code>matrix_slice<MAT, TRI><br /> ms(m, slice1,
- slice2);</code></td>
- <td>a matrix referencing a non continues submatrix of elements in
- the matrix <code>m</code>.</td>
- </tr>
- </tbody>
- </table>
- <h2><a id="tensors">Tensors</a></h2>
- <table border="1" summary="tensor types">
- <thead>
- <tr>
- <th width="10%">Definition</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>tensor<T [, F, A]><br /> t(size1, size2, ... );</code></td>
- <td>a dense matrix of values of type <code>T</code> of variable
- size. A storage type <code>A</code> can be specified
- which defaults to <code>std::vector<T></code>.
- The orientation type <code>F</code> defaults to
- <code>first_order</code>.
- Elements are constructed by <code>A</code>, which need not initialise their value.</td>
- </tr>
- </tbody>
- </table>
- <h2><a id="storage_layout">Special Storage Layouts</a></h2>
- <p>The library supports conventional dense, packed and basic sparse
- vector and matrix storage layouts. The description of the most
- common constructions of vectors and matrices comes next.</p>
- <table border="1" summary="storage layouts">
- <tbody>
- <tr>
- <th width="30%">Construction</th>
- <th>Comment</th>
- </tr>
- <tr>
- <td><code>vector<T,<br />
- std::vector<T> ><br />
- v (size)</code></td>
- <td>a dense vector, storage is provided by a standard
- vector.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>vector<T,<br />
- unbounded_array<T> ><br />
- v (size)</code></td>
- <td>a dense vector, storage is provided by a heap-based
- array.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>vector<T,<br />
- bounded_array<T, N> ><br />
- v (size)</code></td>
- <td>a dense vector, storage is provided by a stack-based
- array.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>mapped_vector<T,<br />
- std::map<std::size_t, T> ><br />
- v (size, non_zeros)</code></td>
- <td>a sparse vector, storage is provided by a standard
- map.</td>
- </tr>
- <tr>
- <td><code>mapped_vector<T,<br />
- map_array<std::size_t, T> ><br />
- v (size, non_zeros)</code></td>
- <td>a sparse vector, storage is provided by a map
- array.</td>
- </tr>
- <tr>
- <td><code>matrix<T,<br />
- row_major,<br />
- std::vector<T> ><br />
- m (size1, size2)</code></td>
- <td>a dense matrix, orientation is row major, storage is
- provided by a standard vector.</td>
- </tr>
- <tr>
- <td><code>matrix<T,<br />
- column_major,<br />
- std::vector<T> ><br />
- m (size1, size2)</code></td>
- <td>a dense matrix, orientation is column major, storage
- is provided by a standard vector.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>matrix<T,<br />
- row_major,<br />
- unbounded_array<T> ><br />
- m (size1, size2)</code></td>
- <td>a dense matrix, orientation is row major, storage is
- provided by a heap-based array.</td>
- </tr>
- <tr>
- <td><code>matrix<T,<br />
- column_major,<br />
- unbounded_array<T> ><br />
- m (size1, size2)</code></td>
- <td>a dense matrix, orientation is column major, storage
- is provided by a heap-based array.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>matrix<T,<br />
- row_major,<br />
- bounded_array<T, N1 * N2> ><br />
- m (size1, size2)</code></td>
- <td>a dense matrix, orientation is row major, storage is
- provided by a stack-based array.</td>
- </tr>
- <tr>
- <td><code>matrix<T,<br />
- column_major,<br />
- bounded_array<T, N1 * N2> ><br />
- m (size1, size2)</code></td>
- <td>a dense matrix, orientation is column major, storage
- is provided by a stack-based array.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>triangular_matrix<T,<br />
- row_major, F, A><br />
- m (size)</code></td>
- <td>a packed triangular matrix, orientation is row
- major.</td>
- </tr>
- <tr>
- <td><code>triangular_matrix<T,<br />
- column_major, F, A><br />
- m (size)</code></td>
- <td>a packed triangular matrix, orientation is column
- major.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>banded_matrix<T,<br />
- row_major, A><br />
- m (size1, size2, lower, upper)</code></td>
- <td>a packed banded matrix, orientation is row
- major.</td>
- </tr>
- <tr>
- <td><code>banded_matrix<T,<br />
- column_major, A><br />
- m (size1, size2, lower, upper)</code></td>
- <td>a packed banded matrix, orientation is column
- major.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>symmetric_matrix<T,<br />
- row_major, F, A><br />
- m (size)</code></td>
- <td>a packed symmetric matrix, orientation is row
- major.</td>
- </tr>
- <tr>
- <td><code>symmetric_matrix<T,<br />
- column_major, F, A><br />
- m (size)</code></td>
- <td>a packed symmetric matrix, orientation is column
- major.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>hermitian_matrix<T,<br />
- row_major, F, A><br />
- m (size)</code></td>
- <td>a packed hermitian matrix, orientation is row
- major.</td>
- </tr>
- <tr>
- <td><code>hermitian_matrix<T,<br />
- column_major, F, A><br />
- m (size)</code></td>
- <td>a packed hermitian matrix, orientation is column
- major.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>mapped_matrix<T,<br />
- row_major,<br />
- std::map<std::size_t, T> ><br />
- m (size1, size2, non_zeros)</code></td>
- <td>a sparse matrix, orientation is row major, storage
- is provided by a standard map.</td>
- </tr>
- <tr>
- <td><code>mapped_matrix<T,<br />
- column_major,<br />
- std::map<std::size_t, T> ><br />
- m (size1, size2, non_zeros)</code></td>
- <td>a sparse matrix, orientation is column major,
- storage is provided by a standard map.</td>
- </tr>
- <tr>
- <td><code>mapped_matrix<T,<br />
- row_major,<br />
- map_array<std::size_t, T> ><br />
- m (size1, size2, non_zeros)</code></td>
- <td>a sparse matrix, orientation is row major, storage
- is provided by a map array.</td>
- </tr>
- <tr>
- <td><code>mapped_matrix<T,<br />
- column_major,<br />
- map_array<std::size_t, T> ><br />
- m (size1, size2, non_zeros)</code></td>
- <td>a sparse matrix, orientation is column major,
- storage is provided by a map array.</td>
- </tr>
- <tr>
- <td><code>compressed_matrix<T,<br />
- row_major><br />
- m (size1, size2, non_zeros)</code></td>
- <td>a compressed matrix, orientation is row major.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>compressed_matrix<T,<br />
- column_major><br />
- m (size1, size2, non_zeros)</code></td>
- <td>a compressed matrix, orientation is column
- major.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>coordinate_matrix<T,<br />
- row_major><br />
- m (size1, size2, non_zeros)</code></td>
- <td>a coordinate matrix, orientation is row major.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- <tr>
- <td><code>coordinate_matrix<T,<br />
- column_major><br />
- m (size1, size2, non_zeros)</code></td>
- <td>a coordinate matrix, orientation is column
- major.<br />
- The storage layout usually is BLAS compliant.</td>
- </tr>
- </tbody>
- </table>
- <hr />
- <p>Copyright (©) 2000-2004 Joerg Walter, Mathias Koch, Gunter
- Winkler, Michael Stevens<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>
|