3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 19:53:45 +01:00
dft_tools/doc/reference/c++/arrays/containers/regular.rst

136 lines
6.9 KiB
ReStructuredText
Raw Normal View History

2013-08-22 16:55:51 +02:00
.. highlight:: c
array, matrix & vector
===========================================
**Synopsis**:
.. code-block:: c
2013-08-27 19:17:17 +02:00
template <typename ValueType, int Rank, ull_t OptionsFlags=0, ull_t TraversalOrder=0> class array;
template <typename ValueType, ull_t OptionsFlags=0, ull_t TraversalOrder=0> class matrix;
template <typename ValueType, ull_t OptionsFlags=0> class vector;
2013-08-22 16:55:51 +02:00
where triqs::ull_t is the type defined by :
.. code-block:: c
typedef unsigned long long ull_t;
* The library provides three basic containers :
* array : general (rectangular) `N`-dimensionnal array; models :ref:`MutableCuboidArray` concept.
* matrix : models the :ref:`MutableMatrix` concept.
* vector : models the :ref:`MutableVector` concept.
and the corresponding view classes : array_view, matrix_view, vector_view (Cf :ref:`partial_views`).
* The matrix and vector are very similar to an array of dimension 2 and 1 respectivily,
except for their algebra. Array form an array algebra, where operation are done element-wise, while matrix and vector
form the usual algebra and vector space of linear algebra.
Template parameters
----------------------------
2013-08-27 19:17:17 +02:00
+-----------------------------------------+-------------------------------+-------------------------------+--------------------------------------+
| Template parameter | Accepted type | Access in the class | Meaning |
+=========================================+===============================+===============================+======================================+
| ValueType | any regular type (typically a | value_type | The type of the element of the array |
| | scalar). | | |
+-----------------------------------------+-------------------------------+-------------------------------+--------------------------------------+
| Rank | int | rank | The rank of the array |
+-----------------------------------------+-------------------------------+-------------------------------+--------------------------------------+
| :ref:`OptionsFlags<arr_templ_par_opt>` | ull_t | opt_flags | Compile time options |
+-----------------------------------------+-------------------------------+-------------------------------+--------------------------------------+
| :ref:`TraversalOrder<arr_templ_par_to>` | ull_t | | Traversal Order for all loops |
+-----------------------------------------+-------------------------------+-------------------------------+--------------------------------------+
NB: Rank is only present for array, since matrix have rank 2 and vector rank 1.
2013-08-22 16:55:51 +02:00
2013-08-27 19:17:17 +02:00
.. toctree::
:hidden:
2013-08-22 16:55:51 +02:00
2013-08-27 19:17:17 +02:00
template_parameters
2013-08-30 11:07:39 +02:00
2013-08-27 19:17:17 +02:00
Member types
--------------------------------------
2013-08-22 16:55:51 +02:00
2013-08-27 19:17:17 +02:00
+--------------+----------------------------------------------------------+
| Member type | Definitions |
+==============+==========================================================+
| value_type | ValueType |
+--------------+----------------------------------------------------------+
| view_type | The corresponding view type |
+--------------+----------------------------------------------------------+
| regular_type | The corresponding regular type i.e. the container itself |
+--------------+----------------------------------------------------------+
2013-08-22 16:55:51 +02:00
2013-08-27 19:17:17 +02:00
Member constexpr
--------------------------------------
2013-08-22 16:55:51 +02:00
2013-08-27 19:17:17 +02:00
+--------+------+-------------------------------+
| Member | Type | Definitions |
+========+======+===============================+
| rank | int | Rank of the container (Rank |
| | | for array), 2 for matrix, 1 |
| | | for vector |
+--------+------+-------------------------------+
2013-08-22 16:55:51 +02:00
Member functions
---------------------
2013-08-27 19:17:17 +02:00
+-------------------------------------------+------------------------------------------+
| Member function | Meaning |
+===========================================+==========================================+
| :ref:`(constructor)<arr_reg_constr>` | |
+-------------------------------------------+------------------------------------------+
| (destructor) | |
+-------------------------------------------+------------------------------------------+
| :ref:`operator =<arr_reg_assign>` | assigns values to the container |
+-------------------------------------------+------------------------------------------+
| :ref:`operator +=,-=,*=,/=<arr_comp_ops>` | compound assignment operators |
+-------------------------------------------+------------------------------------------+
| :ref:`operator ()<arr_call>` | element of access/views/lazy expressions |
+-------------------------------------------+------------------------------------------+
| begin/cbegin | returns iterator to the beginning |
+-------------------------------------------+------------------------------------------+
| end/cend | returns iterator to the end |
+-------------------------------------------+------------------------------------------+
| :ref:`resize<arr_resize>` | resize the container |
+-------------------------------------------+------------------------------------------+
| bool is_empty() const | Is the array empty ? |
+-------------------------------------------+------------------------------------------+
2013-08-22 16:55:51 +02:00
.. toctree::
:hidden:
reg_constructors
reg_assign
2013-08-30 11:07:39 +02:00
compound_ops
2013-08-22 16:55:51 +02:00
call
resize
STL
Non-member functions
------------------------
2013-08-27 19:17:17 +02:00
+---------------------------------+-------------------------------------------+
| Member function | Meaning |
+=================================+===========================================+
| :ref:`swap<arr_swap>` | Swap of 2 containers |
+---------------------------------+-------------------------------------------+
| :ref:`deep_swap<arr_deep_swap>` | Deep swap of the data of 2 containers ??? |
+---------------------------------+-------------------------------------------+
| :ref:`operator\<\<<arr_stream>` | Writing to stream |
+---------------------------------+-------------------------------------------+
2013-08-22 16:55:51 +02:00
.. toctree::
:hidden:
2013-08-27 19:17:17 +02:00
stream
2013-08-30 11:07:39 +02:00
swap