2014-10-17 18:15:19 +02:00
|
|
|
Multidimensional arrays
|
2013-12-18 15:50:18 +01:00
|
|
|
==========================
|
2013-07-17 19:24:07 +02:00
|
|
|
|
|
|
|
.. highlight:: c
|
|
|
|
|
2013-12-18 15:50:18 +01:00
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 1
|
|
|
|
|
|
|
|
TRIQS comes with a library of multidimensional arrays.
|
|
|
|
This library, among others, allows for easy slicing, archiving and algebraic manipulations of multidimensional arrays.
|
|
|
|
Here are a couple of simple examples showing the basic use of this class.
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2013-08-31 00:04:09 +02:00
|
|
|
|
2013-07-17 19:24:07 +02:00
|
|
|
Declaring and printing an array
|
|
|
|
-------------------------------
|
2014-05-31 19:12:21 +02:00
|
|
|
.. triqs_example:: ./array_tutorial_0.cpp
|
2013-07-17 19:24:07 +02:00
|
|
|
Simple operations
|
|
|
|
-------------------
|
|
|
|
|
2014-05-31 19:12:21 +02:00
|
|
|
.. triqs_example:: ./array_tutorial_1.cpp
|
2013-07-17 19:24:07 +02:00
|
|
|
HDF5 Archiving
|
|
|
|
-------------------
|
|
|
|
Archiving an array into an HDF5 file is easy:
|
|
|
|
|
2014-05-31 19:12:21 +02:00
|
|
|
.. triqs_example:: ./array_tutorial_2.cpp
|
2013-07-17 19:24:07 +02:00
|
|
|
Views: ranges and slices
|
|
|
|
-------------------------
|
|
|
|
One can easily take a slice of an array to view and modify only part of the underlying data.
|
|
|
|
|
2014-05-31 19:12:21 +02:00
|
|
|
.. triqs_example:: ./array_tutorial_3.cpp
|
2013-07-17 19:24:07 +02:00
|
|
|
Matrices and vectors
|
|
|
|
-------------------------
|
|
|
|
Arrays must be distinguished from vectors and matrices, which have an algebra of their own.
|
|
|
|
|
2014-05-31 19:12:21 +02:00
|
|
|
.. triqs_example:: ./array_tutorial_4.cpp
|
2013-07-17 19:24:07 +02:00
|
|
|
Defining through a lazy expression
|
|
|
|
-----------------------------------
|
|
|
|
|
2014-05-31 19:12:21 +02:00
|
|
|
.. triqs_example:: ./array_tutorial_5.cpp
|
2013-07-17 19:24:07 +02:00
|
|
|
Linear algebra
|
|
|
|
---------------
|
|
|
|
|
2014-05-31 19:12:21 +02:00
|
|
|
.. triqs_example:: ./array_tutorial_6.cpp
|
2013-07-17 19:24:07 +02:00
|
|
|
Map and fold
|
|
|
|
-------------
|
|
|
|
|
2014-05-31 19:12:21 +02:00
|
|
|
.. triqs_example:: ./array_tutorial_7.cpp
|
2013-12-18 15:50:18 +01:00
|
|
|
The full reference of the array library can be found :doc:`here <../../reference/c++/arrays/contents>`
|