diff --git a/doc/reference/c++/arrays/contents.rst b/doc/reference/c++/arrays/contents.rst index 2fd565b8..1ee2476f 100644 --- a/doc/reference/c++/arrays/contents.rst +++ b/doc/reference/c++/arrays/contents.rst @@ -10,7 +10,6 @@ Multidimensional arrays .. toctree:: :maxdepth: 1 - :numbered: introduction concepts @@ -35,4 +34,4 @@ Multidimensional arrays multithreading FAQ implementation_notes/contents - + ./../../../tutorials/c++/array_tutorial diff --git a/doc/reference/c++/det_manip/contents.rst b/doc/reference/c++/det_manip/contents.rst index 85f9acf0..5075cb50 100644 --- a/doc/reference/c++/det_manip/contents.rst +++ b/doc/reference/c++/det_manip/contents.rst @@ -39,4 +39,4 @@ This class implements these general operations. It contains : det_manip behind - cookbook/contents + ./../../../tutorials/c++/det_manip_tutorial diff --git a/doc/reference/c++/det_manip/cookbook/basic.rst b/doc/reference/c++/det_manip/cookbook/basic.rst deleted file mode 100644 index 87e3d7c6..00000000 --- a/doc/reference/c++/det_manip/cookbook/basic.rst +++ /dev/null @@ -1,68 +0,0 @@ -Basics ------- - -Here, an exemple of creation of a class det_manip, of use of insert and remove. - -.. compileblock:: - - #include - - struct fun { - - typedef double result_type; - typedef double argument_type; - - //gives the coefficients of the matrix - double operator()(double x, double y) const { - return(x-y); - } - }; - - int main() { - - //creation of the class det_manip - fun f; - int init_size=100; - triqs::det_manip::det_manip D(f,init_size); - //the initial matrix is empty: - std::cout<` is available here. Example -------------- +--------- -.. code-block:: c +.. compileblock:: + + #include struct fun { @@ -89,7 +91,7 @@ Example typedef double argument_type; double operator()(double x, double y) const { - const double pi = acos(-1); + const double pi = acos(-1.); const double beta = 10.0; const double epsi = 0.1; double tau = x-y; @@ -103,14 +105,18 @@ Example int main() { fun f; - triqs::det_manip::det_manip D; + triqs::det_manip::det_manip D(f,100); - /// .... - double x=2, y=9, detratio; - detratio = D.try_insert(1,3, x,y); + /// insertions of 3 lines and 3 columns + double x=2., y=9., detratio; + detratio = D.try_insert(0, 0, x, y ); + D.complete_operation(); + detratio = D.try_insert(0, 1, 2., 3.); + D.complete_operation(); + detratio = D.try_insert(0, 0, 4., 5.); D.complete_operation(); - ///... + /// removal of a line (the 3rd) and a column (the 2nd) detratio = D.try_remove(2,1); D.complete_operation(); } diff --git a/doc/reference/python/green/block.rst b/doc/reference/python/green/block.rst index e6435551..00945426 100644 --- a/doc/reference/python/green/block.rst +++ b/doc/reference/python/green/block.rst @@ -183,7 +183,7 @@ behaves like .. math:: - g(z) \sim ... + M_{-1} z + M_0 + \frac{M_1}{z} + \frac{M_2}{z} + ... + g(z) \sim ... + M_{-1} z + M_0 + \frac{M_1}{z} + \frac{M_2}{z^2} + ... where :math:`M_i` are matrices with the same dimensions as :math:`g`. diff --git a/doc/tutorials/c++/array_tutorial.rst b/doc/tutorials/c++/array_tutorial.rst index 12f8cd5c..fcc3e91c 100644 --- a/doc/tutorials/c++/array_tutorial.rst +++ b/doc/tutorials/c++/array_tutorial.rst @@ -1,9 +1,14 @@ -Using arrays -=============== +Examples of use of arrays +========================== .. highlight:: c -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. +.. 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. Declaring and printing an array @@ -173,4 +178,4 @@ Map and fold std::cout << "F(2*A) = "<` +The full reference of the array library can be found :doc:`here <../../reference/c++/arrays/contents>` diff --git a/doc/tutorials/c++/contents.rst b/doc/tutorials/c++/contents.rst index debc413c..62823cd9 100644 --- a/doc/tutorials/c++/contents.rst +++ b/doc/tutorials/c++/contents.rst @@ -9,6 +9,6 @@ C++ libraries :maxdepth: 1 array_tutorial - + det_manip_tutorial .. diff --git a/doc/tutorials/c++/det_manip_tutorial.rst b/doc/tutorials/c++/det_manip_tutorial.rst new file mode 100644 index 00000000..d01b71e1 --- /dev/null +++ b/doc/tutorials/c++/det_manip_tutorial.rst @@ -0,0 +1,227 @@ +Det_manip cookbook +=================== + +.. highlight:: c + +.. toctree:: + :maxdepth: 1 + +TRIQS comes with a class called det_manip to easily perform operations on a special type of matrices +(see :doc:`here <../../reference/c++/det_manip/contents>`). +This library, among others, allows to easily add or remove lines or columns to the matrix, to calculate the determinant and the inverse. +Here are a couple of simple examples showing the basic use of this class. + + + +Creation of an empty det_manip class +------------------------------------- + +.. compileblock:: + + #include + + struct fun { + + typedef double result_type; + typedef double argument_type; + + //gives the coefficients of the matrix (function F of the documentation) + double operator()(double x, double y) const { + return(x-y); + } + + }; + + int main() { + + fun f; + int init_size = 100; // maximum size of the matrix before a resize + + //creation of a class det_manip + triqs::det_manip::det_manip D(f, init_size); + + //the initial matrix is empty: + std::cout< + + struct fun { + typedef double result_type; + typedef double argument_type; + double operator()(double x, double y) const { return(exp(x)-y*y); } + }; + + int main() { + triqs::det_manip::det_manip D(fun(), std::vector{1,2,2.5}, std::vector{3,4,9}); + std::cout<