From f251308959979f889e0a5a639c066f06a578f906 Mon Sep 17 00:00:00 2001 From: Olivier Parcollet Date: Wed, 4 Sep 2013 17:05:33 +0200 Subject: [PATCH] Work on doc --- doc/reference/c++/arrays/Interop_Python.rst | 5 +++ doc/reference/c++/arrays/blas_lapack.rst | 29 ++++--------- doc/reference/c++/arrays/contents.rst | 5 +++ doc/reference/c++/clef/contents.rst | 4 +- doc/reference/c++/contents.rst | 6 ++- doc/reference/c++/det_manip/contents.rst | 4 ++ doc/reference/c++/gf/contents.rst | 3 ++ doc/reference/c++/parameters/parameters.rst | 9 +++- .../triqs_library.rst | 42 +++++++++---------- 9 files changed, 60 insertions(+), 47 deletions(-) rename doc/reference/c++/{learn => using_the_lib}/triqs_library.rst (76%) diff --git a/doc/reference/c++/arrays/Interop_Python.rst b/doc/reference/c++/arrays/Interop_Python.rst index b8a37893..3e1abd3a 100644 --- a/doc/reference/c++/arrays/Interop_Python.rst +++ b/doc/reference/c++/arrays/Interop_Python.rst @@ -5,6 +5,11 @@ Interface with Python numpy arrays The array, matrix, vector and their views are fully interoperable with the numpy array objects in python. +.. warning:: + + Doc need to be largely improved here... + + From Python to C++ -------------------------- diff --git a/doc/reference/c++/arrays/blas_lapack.rst b/doc/reference/c++/arrays/blas_lapack.rst index e2a3e9e1..77ad21c2 100644 --- a/doc/reference/c++/arrays/blas_lapack.rst +++ b/doc/reference/c++/arrays/blas_lapack.rst @@ -3,6 +3,10 @@ Linear algebra =============================================== +.. warning:: + + Doc still largely to be written and updated.... + Several standard linear algebra operations are provided for the matrix and vector. Note however that matrix and vector are not the main purpose of this library, hence the linear algebra support is less extended than other purely matrix library, @@ -21,8 +25,8 @@ The * operator map the matrix x matrix and matrix x vector product. Example : matrix * matrix and * vector ... -.. compileblock:: - +.. + compileblock:: #include using triqs::arrays::matrix; using triqs::clef::placeholder; int main() { @@ -30,32 +34,13 @@ Example : matrix * matrix and * vector ... placeholder<0> i_; placeholder<1> j_; matrix A (2,2), B(2,2), C; A(i_,j_) << i_ + j_ ; B(i_,j_) << 2*i_ + j_ ; - - // Making the product C= A*B; - // Note that the * returns a lazy object - // that has ImmutableArray concept, and defines a specialized version assignment. - // compiler rewrites this as something like matmul_with_lapack (A,B,C); - // There are no temporary here. - - std::cout<< " C = " << C<< std::endl; - std::cout<< " A*B = " << A*B << std::endl; // NB A*B does not return a matrix, but - // a lazy expression which is not evaluated until needed. + std::cout<< " C = " << C<< std::endl; } For types that lapack do not use, a generic version of the matrix product is provided. (same syntax, the dispatch is made at compile time depending of the type of the matrices). -NB : - -* The **generic** version of the product will be used if -both matrices do not have the same type. -**Is this reasonnable ??**. - -* Is the matrix's slowest index is not contiguous, blas/lapack can not be called directly. - So a temporary copy will be made to reorganize the matrix before calling blas/lapack. - Code is therefore (normally !) always correct, but this can produce a serious performance hit. - Matrix inversion ---------------------- diff --git a/doc/reference/c++/arrays/contents.rst b/doc/reference/c++/arrays/contents.rst index aee45891..e0608afe 100644 --- a/doc/reference/c++/arrays/contents.rst +++ b/doc/reference/c++/arrays/contents.rst @@ -1,6 +1,11 @@ Multidimensional arrays ******************************************* +.. warning:: + This library is of stable quality, except when mentionned otherwise (for some recent features). + + Documentation is still work in progress. + .. highlight:: c .. toctree:: diff --git a/doc/reference/c++/clef/contents.rst b/doc/reference/c++/clef/contents.rst index 85484075..13a1db23 100644 --- a/doc/reference/c++/clef/contents.rst +++ b/doc/reference/c++/clef/contents.rst @@ -5,7 +5,9 @@ Clef expressions library .. warning:: - This library is still a prototype, of alpha quality. + This library is still a prototype, of alpha quality. + + Documentation is not fully up to date : work in progress. The little CLEF library (Compile time Lazy Expression and Function) is a simple lambda library for C++11, to store and code formal expressions diff --git a/doc/reference/c++/contents.rst b/doc/reference/c++/contents.rst index 4dc0e177..2ed0fd07 100644 --- a/doc/reference/c++/contents.rst +++ b/doc/reference/c++/contents.rst @@ -2,10 +2,14 @@ C++ ============= +.. warning:: + + This documentation is work in progress. + .. toctree:: :maxdepth: 1 - learn/intro + using_the_lib/contents arrays/contents gf/contents clef/contents diff --git a/doc/reference/c++/det_manip/contents.rst b/doc/reference/c++/det_manip/contents.rst index 723d3bc4..e83af47c 100644 --- a/doc/reference/c++/det_manip/contents.rst +++ b/doc/reference/c++/det_manip/contents.rst @@ -3,6 +3,10 @@ Manipulations of determinants ============================= +.. warning:: + + This library is stable, but documentation is still a bit spartan ... + The purpose of this little class is to regroup standard block manipulations on determinant, used in several QMC. diff --git a/doc/reference/c++/gf/contents.rst b/doc/reference/c++/gf/contents.rst index b278da72..a58e2466 100644 --- a/doc/reference/c++/gf/contents.rst +++ b/doc/reference/c++/gf/contents.rst @@ -6,6 +6,9 @@ Green functions The TRIQS library provides a generic container `gf` and its view `gf_view`, to store and manipulate various Green functions. +.. warning:: + + This library is still alpha. API may evolve. Documentation still in progress. .. toctree:: :maxdepth: 2 diff --git a/doc/reference/c++/parameters/parameters.rst b/doc/reference/c++/parameters/parameters.rst index a63d6d44..50ce6cd1 100644 --- a/doc/reference/c++/parameters/parameters.rst +++ b/doc/reference/c++/parameters/parameters.rst @@ -1,6 +1,13 @@ -parameters +Parameters =============== +.. warning:: + + Library of beta quality. + + Documentation : just intro/tutorial, reference doc in progress. + + Introduction -------------- diff --git a/doc/reference/c++/learn/triqs_library.rst b/doc/reference/c++/using_the_lib/triqs_library.rst similarity index 76% rename from doc/reference/c++/learn/triqs_library.rst rename to doc/reference/c++/using_the_lib/triqs_library.rst index 24cb58fc..be9c7075 100644 --- a/doc/reference/c++/learn/triqs_library.rst +++ b/doc/reference/c++/using_the_lib/triqs_library.rst @@ -1,5 +1,4 @@ - -TRIQS as a library +Building ================== .. highlight:: c @@ -45,17 +44,12 @@ start by writing some sources: OK, our project will be just one :file:`main.cpp` file, e.g.:: - #include - - namespace tqa = triqs::arrays; - + #include + using namespace triqs::arrays; int main(){ - - tqa::array A(10), B(10); - A()=2; B()=3; - tqa::array C = A+B; + array A {1,2,3}, B{10,20,30}, C; + C = A+B; std::cout << "C = "<< C << std::endl; - } As you can see, the code includes headers from TRIQS. Along with @@ -67,26 +61,30 @@ variables, especially the include directories related to the TRIQS headers and the location of the TRIQS libraries. Here is what your simple :file:`CMakeLists.txt` can be: -.. code-block :: bash +.. code-block :: cmake + # Append triqs installed files to the cmake load path + list(APPEND CMAKE_MODULE_PATH ${TRIQS_PATH}/share/triqs/cmake) + + # start configuration cmake_minimum_required(VERSION 2.8) - project(myproj CXX) - - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - set(CMAKE_BUILD_TYPE Release) - SET(CMAKE_INSTALL_RPATH "${TRIQS_PATH}/lib") - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + # We use shared libraries + # option(BUILD_SHARED_LIBS "Build shared libraries" ON) - include(${TRIQS_PATH}/share/triqs/cmake/TRIQSConfig.cmake) + # Load TRIQS, including all predefined variables from TRIQS installation + find_package(TRIQS REQUIRED) + # We want to be installed in the TRIQS tree + set(CMAKE_INSTALL_PREFIX ${TRIQS_PATH}) + + # Build the code, adding triqs in include and link flags add_executable(example main.cpp) + include_directories(${TRIQS_INCLUDE_ALL}) + target_link_libraries(example ${TRIQS_LIBRARY_ALL}) - include_directories(${TRIQS_INCLUDE} ${EXTRA_INCLUDE} ${CBLAS_INCLUDE} ${FFTW_INCLUDE}) - target_link_libraries(example ${TRIQS_LIBRARY} ${EXTRA_LIBRARY}) We're all set! Everything is ready to compile our project. If we want to build everything in :file:`/home/project/build`, we do as follows: