3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 13:53:40 +01:00

Work on doc

This commit is contained in:
Olivier Parcollet 2013-09-04 17:05:33 +02:00
parent b1840d2a32
commit f251308959
9 changed files with 60 additions and 47 deletions

View File

@ -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. 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++ From Python to C++
-------------------------- --------------------------

View File

@ -3,6 +3,10 @@
Linear algebra Linear algebra
=============================================== ===============================================
.. warning::
Doc still largely to be written and updated....
Several standard linear algebra operations are provided for the matrix and vector. 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, 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, 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 ... Example : matrix * matrix and * vector ...
.. compileblock:: ..
compileblock::
#include <triqs/arrays.hpp> #include <triqs/arrays.hpp>
using triqs::arrays::matrix; using triqs::clef::placeholder; using triqs::arrays::matrix; using triqs::clef::placeholder;
int main() { int main() {
@ -30,32 +34,13 @@ Example : matrix * matrix and * vector ...
placeholder<0> i_; placeholder<1> j_; placeholder<0> i_; placeholder<1> j_;
matrix<double> A (2,2), B(2,2), C; matrix<double> A (2,2), B(2,2), C;
A(i_,j_) << i_ + j_ ; B(i_,j_) << 2*i_ + j_ ; A(i_,j_) << i_ + j_ ; B(i_,j_) << 2*i_ + j_ ;
// Making the product
C= A*B; C= A*B;
// Note that the * returns a lazy object std::cout<< " C = " << C<< std::endl;
// 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.
} }
For types that lapack do not use, a generic version of the matrix product is provided. 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). (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 Matrix inversion
---------------------- ----------------------

View File

@ -1,6 +1,11 @@
Multidimensional arrays 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 .. highlight:: c
.. toctree:: .. toctree::

View File

@ -5,7 +5,9 @@ Clef expressions library
.. warning:: .. 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) The little CLEF library (Compile time Lazy Expression and Function)
is a simple lambda library for C++11, to store and code formal expressions is a simple lambda library for C++11, to store and code formal expressions

View File

@ -2,10 +2,14 @@
C++ C++
============= =============
.. warning::
This documentation is work in progress.
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
learn/intro using_the_lib/contents
arrays/contents arrays/contents
gf/contents gf/contents
clef/contents clef/contents

View File

@ -3,6 +3,10 @@
Manipulations of determinants 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 The purpose of this little class is to regroup standard block manipulations on determinant, used in several
QMC. QMC.

View File

@ -6,6 +6,9 @@ Green functions
The TRIQS library provides a generic container `gf` and its view `gf_view`, to store and manipulate The TRIQS library provides a generic container `gf` and its view `gf_view`, to store and manipulate
various Green functions. various Green functions.
.. warning::
This library is still alpha. API may evolve. Documentation still in progress.
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2

View File

@ -1,6 +1,13 @@
parameters Parameters
=============== ===============
.. warning::
Library of beta quality.
Documentation : just intro/tutorial, reference doc in progress.
Introduction Introduction
-------------- --------------

View File

@ -1,5 +1,4 @@
Building
TRIQS as a library
================== ==================
.. highlight:: c .. highlight:: c
@ -45,17 +44,12 @@ start by writing some sources:
OK, our project will be just one :file:`main.cpp` file, e.g.:: OK, our project will be just one :file:`main.cpp` file, e.g.::
#include <triqs/arrays/array.hpp> #include <triqs/arrays.hpp>
using namespace triqs::arrays;
namespace tqa = triqs::arrays;
int main(){ int main(){
array<double,1> A {1,2,3}, B{10,20,30}, C;
tqa::array<double,1> A(10), B(10); C = A+B;
A()=2; B()=3;
tqa::array<double,1> C = A+B;
std::cout << "C = "<< C << std::endl; std::cout << "C = "<< C << std::endl;
} }
As you can see, the code includes headers from TRIQS. Along with 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 the location of the TRIQS libraries. Here is what your simple
:file:`CMakeLists.txt` can be: :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) cmake_minimum_required(VERSION 2.8)
project(myproj CXX) project(myproj CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
SET(CMAKE_INSTALL_RPATH "${TRIQS_PATH}/lib") # We use shared libraries
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # option(BUILD_SHARED_LIBS "Build shared libraries" ON)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
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) 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 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: everything in :file:`/home/project/build`, we do as follows: