mirror of
https://github.com/triqs/dft_tools
synced 2024-12-25 05:43:40 +01:00
Work on doc
This commit is contained in:
parent
b1840d2a32
commit
f251308959
@ -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++
|
||||
--------------------------
|
||||
|
||||
|
@ -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 <triqs/arrays.hpp>
|
||||
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<double> 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
|
||||
----------------------
|
||||
|
@ -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::
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,13 @@
|
||||
parameters
|
||||
Parameters
|
||||
===============
|
||||
|
||||
.. warning::
|
||||
|
||||
Library of beta quality.
|
||||
|
||||
Documentation : just intro/tutorial, reference doc in progress.
|
||||
|
||||
|
||||
Introduction
|
||||
--------------
|
||||
|
||||
|
@ -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 <triqs/arrays/array.hpp>
|
||||
|
||||
namespace tqa = triqs::arrays;
|
||||
|
||||
#include <triqs/arrays.hpp>
|
||||
using namespace triqs::arrays;
|
||||
int main(){
|
||||
|
||||
tqa::array<double,1> A(10), B(10);
|
||||
A()=2; B()=3;
|
||||
tqa::array<double,1> C = A+B;
|
||||
array<double,1> 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:
|
Loading…
Reference in New Issue
Block a user