3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 19:53:45 +01:00
Commit Graph

103 Commits

Author SHA1 Message Date
Olivier Parcollet
de0e41ed15 gf: finish block iterator 2013-10-22 21:29:27 +02:00
Olivier Parcollet
cbf2142af6 gf curry: clean call for a single index
- if the index is not a tuple, make it a tuple...
- better API.
2013-10-21 17:05:15 +02:00
Olivier Parcollet
9edda8724d implement gf_const_view 2013-10-21 15:12:53 +02:00
Olivier Parcollet
9002c1e456 implement array_const_view 2013-10-21 15:12:53 +02:00
Olivier Parcollet
1517cdaaeb clean the TRIQS_COMPILER macros
- from now on, C++11 compilers only.
- no ressources to maintain old stuff.
2013-10-21 15:12:08 +02:00
Olivier Parcollet
39edb2f846 [API change] gf : factories -> constructors
- Make more general constructors for the gf.
  gf( mesh, target_shape_t)
- remove the old make_gf for the basic gf.
- 2 var non generic gf removed.
- clean evaluator
- add tensor_valued
- add a simple vertex test.
- clean specialisation
- Fix bug introduced in 1906dc3
- forgot to resize the gf in new version of operator =
- Fix make_singularity in gf.hpp

- clean resize in operator =

- update h5 read/write for block gf
  - changed a bit the general trait to save *all* the gf.
  - allows a more general specialization, then a correct for blocks

- NOT FINISHED : need to save the block indice for python.
  How to reread ?
  Currently it read the blocks names and reconstitute the mesh from it.
  Is it sufficient ?

- clean block constructors

 - block constructors simplest possible : an int for the number of blocks
 - rest in free factories.
 - fixed the generic constructor from GfType for the regular type :
   only enable iif GfType is ImmutableGreenFunction

- multivar. fix linear index in C, and h5 format

  - linear index now correctly flatten in C mode
    (was in fortran mode), using a simple reverse of the tuple in the folding.
  - fix the h5 read write of the multivar fonctions
   in order to write an array on dimension # variables + dim_target
   i.e. without flattening the indices of the meshes.
   Easier for later data analysis, e.g. in Python.

- merge matrix/tensor_valued. improve factories

  - matrix_valued now = tensor_valued<2>
    (simplifies generic code for h5).
  - factories_one_var -> factories : this is the generic case ...
    only a few specialization, code is simpler.

- clef expression call with rvalue for *this
- generalize matrix_proxy to tensor and clean

 - clean exception catch in tests

  - exception catching catch in need in test
    because the silly OS X does not print anything, just "exception occurred".
    Very convenient for the developer...
  - BUT, one MUST add return 1, or the make test will *pass* !!
  - --> systematically replace the catch by a macro TRIQS_CATCH_AND_ABORT
    which return a non zero error code.
   - exception : curry_and_fourier which does not work at this stage
   (mesh incompatible).

- gf: clean draft of gf 2 times
  - comment the python interface for the moment.
  - rm useless tests
2013-10-21 15:11:44 +02:00
Olivier Parcollet
588dd6e50a arrays: clean inverse
- does not use view
- determinant not lazy any more
2013-10-17 00:32:09 +02:00
Olivier Parcollet
800aea4c5e remove workaround for icc 13.0
- deprecated....
- remove the TRIQS_WORKAROUND_INTEL_COMPILER_BUGS macro
2013-10-17 00:32:09 +02:00
Olivier Parcollet
4d0bb56790 arrays. Clean expression templates
- clean array, matrix, vector expression template
  they take const & of objects, or move && objects
  no more views. -> C++11 modernisation
- Fix a bug in array resize : it was resetting the indexmap
  to C memory layout e.g. for a fortran array
- Fix a bug in read h5 array when not in C order
  (forgot an else, the array was read twice).
2013-10-17 00:32:09 +02:00
Olivier Parcollet
6f7deca96a tuple tools : add reverse for a tuple...
- add in std:: the reverse to be able to apply the algorithms on a
  reversed tuple
- overloaded std::get, std::tuple_size for this
- added tests.
2013-09-28 22:54:21 +02:00
Olivier Parcollet
7607d3963d Fix 2cca958 for gcc 4.6
- forgot a type...
2013-09-13 20:26:46 +02:00
Olivier Parcollet
2cca9584b9 mpi: first draft for #12
- a thin layer, using a bit boost::mpi (for the communicator mostly ...)
  along the lines discussed in #12.
- implemented reduce, allreduce, bcast for arrays, simple scalars,
and any custom type that support boost serialization.
- Custom types :  the operations are done recursively on members.
  No change is needed in the class to use this mpi routine, as long as
  serialize function is defined.
- For arrays of basic types (int, double...), a direct call to MPI C API, which works also for views
  (as long as they are contiguous).
- For arrays of more complex types, we revert to boost::mpi.
- Added a simple test.
- Work still in progress :
   - missing a simple scatter/gather for the arrays
   - need more tests & API thinking.
   - dispatch array code to array lib
   - reduce is "sum" only, but do we need more.
2013-09-13 09:20:21 +02:00
Michel Ferrero
f0dfabff38 Change tail implementation with fixed array size
Now the tail have a fixed size. It actually makes everything simpler. I took
order_min = -1 and order_max = 8. This makes the tails compatible with the
previous implementation. However we might want to change this to something like
-10, 10 so that they are self-contained. This commit should also fix issue #11.
2013-09-12 15:21:56 +02:00
Olivier Parcollet
0586c77307 add c14 details in std::c14
- to use already a few c14 convenience details :

-> polymorphic std::plus, e.g.
   boost::mpi::reduce (world, A,C, std::c14::plus<>(),0);
this plus determine the type by itself ...
  -> errors on the type can be very cryptic on the gf.

-> add std::c14::make_unique
(equivalent of make_shared for unique_ptr).
2013-09-11 20:22:38 +02:00
Olivier Parcollet
b534936589 Fix matrix * alias issue and adapt det_manip
- The previous version of the * operator for matrix was too clever.
It was giving a lazy object and then rewriting C = A *B into gemm (a,A,B,0,C).
The pb was in case of aliasing : when e.g. C = A, or is a part of A.
gemm is not correct that case, and as a result generic code like
a = a *b
may not be correct in matrix case, which is unacceptable.

- So we revert to a simple * operator for matrix
that does immediate computation.
Same thing for matrix* vector

- we also suppress a_x_ty class.

-> for M = a * b,
when M is a matrix, there is no overhead due to move assignment
-> however, when M is a view, there is an additionnal copy.

-Correctness comes first, hence the fix.
However, if one wants more speed and one can guarantee that
there is no aliasing possible, then one has to write a direct gemm call.

-> det_manip class was adapted, since in that case, we can show there
no alias, and we want the speed gain, so the * ops where replaced
by direct blas call (using the array blas interface).

-> also gemm, gemv, ger were overloaded in the case the return
matrix/vector (i.e. last parameter of the function) is not an lvalue,
but a temporary view created on the fly.
2013-09-11 18:49:22 +02:00
Olivier Parcollet
c06e183ae5 arrays : revised version of map & fold
- also cleaned a bit reinterpretview example
2013-09-11 18:39:25 +02:00
Laura Messio
257bdb9d6a Work on gf
gf: security in the case beta<0 added in the mesh construction
gf: inline added in slice
test/triqs/gf: test of on_mesh() added
gfs: scalar for two-real_times
test/triqs/gf/ renamed in gfs, test gf_retw.cpp completed
gfs: evaluator homogeneised
two_times: evaluator corrected
test/triqs/gf/ renamed in gfs, test gf_retw.cpp completed

+ Correction after rebase

Fix a test : gf_re_im_freq_time
There is an issue with the last point.
To be fixed.
2013-09-09 15:41:46 +02:00
Laura Messio
6239dee8b3 test/triqs/mc_tools directory added, with an example of simple random walker 2013-09-09 15:41:46 +02:00
Olivier Parcollet
1dd2d9e691 correction after compiling on linux gcc 4.8.1/ clang 3.3
- clef : lazy_method is broken . remove it from the test for the moment.
2013-09-08 15:35:57 +02:00
Olivier Parcollet
4bbcbe35ef gcc 4.6: correction
- removing some test & tuple_tool which fail on old 4.6
For Ubuntu 12.04 compat.
2013-09-08 15:17:18 +02:00
Olivier Parcollet
2c542647fd clef : new version using lvalues and moving rvalues
- change : all objects are by default
  stored now by reference, not by copy any more.
  Unless the trait force_copy_in_expr is true.
- rvalue refs are moved into the tree
- simplifies a lot the writing of lazy method, objects.
- added a macro for methods
- tests ok. Further check needed to control absence of copies...
- improved documentation
2013-09-08 15:04:12 +02:00
Olivier Parcollet
27be5cbd5b arrays: fix some test to avoid valgrind error 2013-09-08 11:58:37 +02:00
Olivier Parcollet
e8bca45cd0 mv test gf -> gfs 2013-09-06 17:51:51 +02:00
Olivier Parcollet
9790fe8bd0 Work on gf
- clean curry.
- start testing.
2013-09-06 16:00:51 +02:00
Olivier Parcollet
b88f62d50e arrays: details while writing doc
- add factories for matrices
- add make_immutablef from a lambda
- details
2013-08-29 18:05:23 +02:00
Olivier Parcollet
0464c8e3b6 move one test to c++11 for obsolete gcc
alias_const_view test is c++11 only.
does not work on gcc 4.6
2013-08-27 14:32:52 +02:00
Olivier Parcollet
b45045e81c gfs: change the name of the mesh -> gf_mesh for gcc
gcc has a pb because the template mesh<Variable,Opt>
has the name same as the gf mesh method (!).
Clang is fine however on this...

Solution : rename the template mesh<...> to gf_mesh...
Not very elegant, but ok.
2013-08-27 14:20:50 +02:00
Olivier Parcollet
0f524b26fc work on doc 2013-08-27 13:43:58 +02:00
Olivier Parcollet
7898bd8d88 gf : mesh now the class, not a trait.
simplify : mesh was a impl trait,
make it the class itself.
corrected the gf, tests and the cython.
2013-08-27 13:43:58 +02:00
Olivier Parcollet
f78e6baf9e code cleaning
- TRIQS_MODEL_CONCEPT renamed : clearer for doc
- index_value_type : remove, useless...
2013-08-27 13:43:58 +02:00
Olivier Parcollet
072b45ac1c arrays: Remove dim0, dim1, .shape in various matrix object.
Not in the concept, not needed, just an annoyance.
replaced by free functions :
first_dim(A), second_dim(A), get_shape(A) and so on...
2013-08-27 13:43:58 +02:00
Olivier Parcollet
c8fcb40164 arrays : rm linalg/determinant and inverse (links)
It is clearer to have only one file :
det_and_inverse.hpp
changed the included in tests.
2013-08-27 13:43:57 +02:00
Olivier Parcollet
017394e17f arrays : add experimental array_const_view
- not completely clear how to
manipulate this alias, in particular when
matching template function
(and portability : require C++11 compiler).
2013-08-27 13:43:57 +02:00
Olivier Parcollet
6fa737978e arrays: remove .len (redundant)
.len -> .shape
with same syntax.
Made a few necessary corrections here and there.
2013-08-27 13:43:57 +02:00
Olivier Parcollet
41bc8d0338 changing non_view_type to regular_type
- cosmetic : for clarity of the code.
2013-08-27 13:43:57 +02:00
Olivier Parcollet
4f4c697897 separate some tests in c++11 dir for old compilers.
new policy : for non standard conforming compilers,
we can skip the tests using new features using recent c++ features.
I.e. compilers below gcc 4.8.1, clang 3.3.
2013-07-30 22:37:41 +02:00
Olivier Parcollet
44bf1e322a gf product and curry. First draft
- works on simple case, to be reread.
- curry in general. To be reread ..
- added some tests.
2013-07-30 22:37:41 +02:00
Olivier Parcollet
c5c016aa79 gf: add gf_scalar test 2013-07-30 22:37:41 +02:00
Olivier Parcollet
65bdc65da1 gf: fix upper bound in out of bounds check in linear mesh 2013-07-29 11:53:02 +02:00
Olivier Parcollet
bd4926157c [API BREAK] rename directory gf -> gfs 2013-07-29 11:53:02 +02:00
Olivier Parcollet
7847b71552 [API BREAK] gf : mesh_pt into []
- All access to grid is now using the [] operator.
() always returns const, and is an evaluation over the domain.

- Now :
 * () is always a call to evaluator (or a lazy expression).
 * mesh_pt accepted by [] , both const and non const,
and not by ().

- Ported the libs (fourier et al.) but this break API.
2013-07-29 11:52:53 +02:00
Olivier Parcollet
40f8cb5c18 [API BREAK] gf : rename namespace gf->gfs
- necessary otherwise the class gf and the namespace have
the same name, leading to some confusion, and need to qualify
some functions (specially on gcc).
Same naming conventions as arrays.
2013-07-28 21:11:28 +02:00
Olivier Parcollet
37f861b0b5 gf: draft of iterator on gf blocks ...
- to be completed
- missing cbegin et al, pb with for(auto & g : ...)
because it returns a view...
2013-07-27 15:06:10 +02:00
Olivier Parcollet
893736dbbf added two little tests ...
- draft of reinterpret_array_view and immutable_diagonal_matrix
2013-07-26 18:23:46 +02:00
Laura Messio
8b4404c1a9 gf: test of retime and refreq improved, the scalar_valued evaluator now works. 2013-07-23 11:31:22 +02:00
Laura Messio
5f133154e8 test of re_im_freq_time.cpp ok 2013-07-23 11:31:22 +02:00
Olivier Parcollet
f4d42a4ec8 arrays : clean an old example 2013-07-23 08:13:52 +02:00
Olivier Parcollet
552c440238 arrays : add ConstView to fix const correctness
- A()(0) = 1
will not work any more if A is const, as it should be.

- Introduced the notion of const_view, simply done by a flag
(flag 0, for easy debug)
- changed the slice of ISP to use it (only on C++11 compliant compiler)
- Move BoundCheck Flags to 5.
2013-07-23 08:13:52 +02:00
Olivier Parcollet
fc2a620eae arrays: new ref counting and weak views
- improve the mem_block and shared_block.
- the reference counting is now done in the mem_block and shared_block, removing the need of shared_ptr.

- speed tests shows that shared_ptr is very slow (due to thread safety?)
the new version is much better, though not perfect.

- Hence introducing weak views.

- also :
-- clean the guard mechanism for python (to allow returning from python without any python ref left).
-- clean code, add documentation for mem_block
-- remove nan init, which was not working, and corresponding test
-- serialisation of view still unchanged (need to forbid serialization of view ??).

- tests ok, incl. valgrind tests.
2013-07-23 08:13:44 +02:00
Laura Messio
798ba1c800 draft of multi-time gf (t,tau), etc... 2013-07-19 13:41:42 +02:00
Laura Messio
38d89e2d01 work on gf: scalar_valued, ...
- introducing scalar_valued gf
- Change Fourier routines to run on scalar_valued,
and then use those routines to run on matrix_valued.
- Tools for slices of 2 variables functions
2013-07-19 13:41:34 +02:00
Olivier Parcollet
aa2c52cb01 utility : tuple, complex_ops
- add _j notation on C++11 compliant compilers
- correct tuple fold (was working in reverse)
- add construction of mini_vector from tuple
2013-07-19 13:27:03 +02:00
Olivier Parcollet
f2c7d449cc First commit : triqs libs version 1.0 alpha1
for earlier commits, see TRIQS0.x repository.
2013-07-17 19:24:07 +02:00