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

85 Commits

Author SHA1 Message Date
Hartmut Hafermann
63fd1b8b2d include map and fold headers into array.hpp 2014-10-16 16:30:48 +02:00
Olivier Parcollet
c7a1a25846 Fix bug in building regular type from python
- the flag is really enforce_copy and should force a copy
- for a view : it is false, no change
- for a regular type : it is true, and now this will enforce the
  copy in the call of numpy. numpy does it for us.
- The problematic case was when we construct a regular type
  from a complicated view in python, which is an array
  but is not C contiguous.
  (hence the PyArray_Check was false, and the C_Contiguous flag was not set)
  Now it is fine, since we ask numpy to systematically copy the data for us
  and build a C contigous array.
  --> the constructor from python does not support custom memory layout
  because numpy only support C and Fortran

Conflicts:

	triqs/arrays/impl/indexmap_storage_pair.hpp
2014-09-18 15:01:17 +02:00
Olivier Parcollet
1a85b9eb81 Fix #122 : correction : forgot inline 2014-09-09 10:06:41 +02:00
Olivier Parcollet
e6234ed3d5 Fix #122
- the conj_ function was not written properly
  (T is a ref, the trait is_complex was not returning true).
- a simpler version is clearly better !
2014-09-08 20:54:59 +02:00
Olivier Parcollet
9265c2db7f Fix #119
- Cleaned of the eigensystems computations (worker is simpler, decision
  at runtime, etc..).
- Fix #119 : When the matrix is in C order, the fortran lapack
  sees in fact its conjugate, so we need to conjugate the eigenvectors at the end.
  NB : not true if the storage order of the matrix is already fortran of course.
2014-09-04 11:55:32 +02:00
Priyanka Seth
c61b8941ee More prettification: can not --> cannot 2014-07-16 23:30:05 +02:00
Olivier Parcollet
9583afc671 Fix #98
- A silly copy paste error : the operator - for matrix expression was
  defined twice.
- second error : a typo in unary method.
2014-07-02 18:22:25 +02:00
Olivier Parcollet
4af1afbdaf hdf5 : clean up
- For users : only change is :
   H5::H5File in apps. to be replaced by triqs::h5::file, same API.

- using only the C API because :
   - it is cleaner, better documented, more examples.
   - it is the native hdf5 interface.
   - simplify the installation e.g. on mac. Indeed, hdf5 is
     usually installed without C++ interface, which is optional.
     E.g. EPD et al., brew by default.
     Also the infamous mpi+ hdf5_cpp bug, for which we have no clean solution.

- clean the notion of parent of a group. Not needed, better iterate function in C LT API.
- modified doc : no need for C++ bindings any more.
- modified cmake to avoid requiring CPP bindings.
2014-06-22 13:57:47 +02:00
Olivier Parcollet
25eec4e046 Silence some gcc warnings...
- Silence some trivial warning.
- TODO: narrowing in a few places.
2014-06-12 17:45:12 +02:00
Olivier Parcollet
842274003f Fix import array in extensions.
- import arrays in extensions (mako file).
- put import_arrays in converter,
  along the lines of our own objects (numpy and triqs uses
  the same capsule technique, i.e. the standard technique from python
  doc.)
2014-06-12 17:27:48 +02:00
Olivier Parcollet
cfe3532c94 array & gf transpose
- implement transposed_view for arrays.
- .transpose method for gf
- wrapped to python
- add call op. for GfImTime, using C++
- Added ChangeLog
- rm matrix_stack
- start cleaning old code
2014-05-22 16:08:23 +02:00
Michel Ferrero
e377522879 Fix wrong commit 068c4a1
The fix in simple_read_write was wrong. This should be correct now.
2014-05-21 00:28:40 +02:00
Michel Ferrero
068c4a116d Fix a bug in simple_read_write.hpp 2014-05-20 18:08:28 +02:00
Olivier Parcollet
e32602180c Cleaning h5 interface 2014-05-11 21:47:52 +02:00
Olivier Parcollet
3a9f986461 gf: add a few functions in C++ 2014-05-11 21:47:52 +02:00
Olivier Parcollet
376056f7bd gf : add indices, name in C++ 2014-05-11 21:47:51 +02:00
Olivier Parcollet
8c725f8d5e Work on compilation speed.
- h5/make_h5.... only used in parameters.
- old boost includes before C++11
- remove boost serialization, make macro TRIQS_MAKE_NVP temporarely
- remove boost::is_complex (can be written in 2 lines...)
- move some lib in cpp
2014-05-02 20:49:19 +02:00
Olivier Parcollet
a730f093d6 arrays: fix fold and update documentation
- fold was not correct in e.g. passing an int as init instead of a
  double (was leading to narrowing in return).
- better return type deduction.
- there was an error in the doc (order of argument in the lambda !)
- add a more complex example (Frobenius norm of matrices).
2014-04-09 21:24:03 +02:00
Olivier Parcollet
4ae4dfd42b arrays: add lazy call to matrix_tensor_proxy
- correction to previous patch
2014-04-07 15:12:34 +02:00
Olivier Parcollet
e1e9ee20fd gf: correct auto_assign
- g(om_)(i_,j_) was not working.
- add the triqs_clef_auto_assign function for matrix_proxy.
- simplified a bit the triqs_clef_auto_assign for gf.
2014-04-07 13:21:36 +02:00
Olivier Parcollet
efb00ea5d3 clef: first version of generic sum function
- to improve with in the case where function return an expression
  template, not a regular type, with a make_regular function
2014-04-04 17:47:21 +02:00
Olivier Parcollet
5267798b48 arrays: a forgotten std::forward in lazy evaluations...
A(i_,0) was not compiling due to a missing forward ...
2014-03-28 17:20:16 +01:00
Olivier Parcollet
8045598534 Attempt to fix gelss call in fit_tail.
uncommenting the resize fix the issue on linux.
valgrind reports no error any more.
What was the problem ?
2014-03-19 14:01:26 +01:00
Olivier Parcollet
5128126055 arrays: change operator() && for const_view
Changed operator()(int, int...) && for array, and views.

- For const_view and regular type, returns value_type (i.e. a copy).
  NB : does make a copy, not a move. Ok for scalar type. TODO: think for complicated types.
  This allows codes like :
  f(x)(0,0) where f : x-> matrix or const_view
  to be correct in clef expression evaluation.

- For _view : return a value_type &, as before to allow :
    A(....)(0,0) = rhs;
  It is not possible to detect dangling refs in that case at compile time.
  Added a security in TRIQS_ARRAYS_DEBUG mode to detect a dangling ref at run time,
  i.e. the case where the view is "unique" (ref count ==1).
  This would be a quite bad design anyway ...

- also :

 - clean operator[] for vector (old workaround for old gcc...)
 - add IsView flag in ISP impl class, for the impl. of operator() &&
2014-03-02 17:11:48 +01:00
Olivier Parcollet
b8d7373177 arrays : fix auto_assign for chains assignment.
A(i_)(om_) << ...
for A an array of gf was not working.
Modified the auto_assign of arrays to handle the case when the object
in the array is itself autoassigned.
Using the model of std::vector adapter for clef, which works.
Also fixed the gf for a little details (gf_impl is usually in the expression tree, not gf).
2014-02-21 21:00:38 +01:00
Olivier Parcollet
76e39c826f arrays: add make_unit_matrix and norm2, norm2_sqr 2014-02-18 15:36:24 +01:00
Olivier Parcollet
1c9d6dacfa arrays: h5 read/write for arrays of complex types
- array of complex type (not fundamental) can now be saved/loaded to
  h5
- with a test with array<gf<...>>
2014-02-13 21:46:23 +01:00
Olivier Parcollet
7aedaef945 arrays : fix matrix = scalar for complex types
Pb :
M() = rhs; // rhs of type RHS
Currenlty does :
M(i,j) = (i==j ? rhs : RHS{})
Changed to
M(i,j) = (i==j ? rhs : RHS{0*rhs})

If RHS is a double, int ... Same result.
If RHS is a matrix, gf, currently the offdiag elements
are default constructed (i.e. of 0 size !).
Which can break operations later (matrix<matrix<double>>)
After change : all elements have the same size !
2014-02-12 21:50:58 +01:00
Olivier Parcollet
dd6b996e5d arrays: to_python now raise exception when array is empty
- otherwise it was simply crashing .
- now raise a C++ exception
- adapted cython wrapper to catch it as a python exception
2014-02-04 15:04:40 +01:00
Hartmut Hafermann
31ae772892 arrays: add gelss 2014-02-03 22:16:58 +01:00
Olivier Parcollet
85141350e7 remove warnings in compilation
- triqs & tests now compiles with -Wall on clang (3.2)
Checked on OS X.
Todo : recheck on other compilers.
2014-01-30 22:17:28 +01:00
Olivier Parcollet
eda6eb90a2 arrays: correction of value_type of matrix_expr
- forgot to correct the value_type of matrix_expr, and vector_expr
as was done long ago for arrays...
- also added cases for arrays until dim 10
- TODO : replace this trait in arrays with a tuple tools for any dim..
  not urgent.
2014-01-30 20:28:30 +01:00
Olivier Parcollet
0f85b08693 add trace for ImmutableMatrix 2014-01-12 20:46:10 +01:00
Olivier Parcollet
2200e2680f gf: imfreq: fix out of bound product gf imfreq
- gf<cartesian_product<imfreq,imfreq>> was not correct
  when out bounds. Fixed evaluator.
- tensor_proxy : fix the trait for algebra which was incorrect.
- TODO: clean code (repetition, put in mesh some windowing).
2014-01-06 19:16:25 +01:00
Olivier Parcollet
bdac3e159c work on doc for gf, and details.
- little details : code cleaning, clang formatting,  along
with documentation writing for c++ gf.
- separated the mesh in small class for better doc.
- work on documentation : reorganize specialisation, ...
2013-12-30 22:32:16 +01:00
Olivier Parcollet
59b969dbd3 arrays: fix mapped_function (conj overload)
- conj overload should return complex, as in standard.
- changed the test output for mapped_function.
- fixed make_matrix_view and example in doc.
2013-12-30 22:32:15 +01:00
Olivier Parcollet
8cc5012347 Fix #42. Conj overload issue
std::conj returns a complex according to std.
On gcc, we need to define it (bug?) but on clang libc++
it is an error.

-> one test is still failing : to be decided later
2013-12-21 20:07:52 +01:00
Olivier Parcollet
17ab555213 gf: fix matsubara_freq and mesh_pt
- cleaner implementation, solve some bugs...
2013-11-20 15:16:53 +01:00
Olivier Parcollet
e703b1e2b7 port to clang 3.4
- little narrowing details
2013-11-18 23:41:32 +01:00
Olivier Parcollet
d7cf223994 arrays: clean cache, add traits ...
- also add simple c14 helpers ....
2013-11-18 23:41:32 +01:00
Olivier Parcollet
9cdc139214 arrays: add conj function for arrays/matrix and tests
- map conj (and extend it for integers).
2013-11-18 23:41:32 +01:00
Olivier Parcollet
fa6f991473 arrays: clean h5 code
- c++11 cleaning, more doc.
- clean the array_stack and its doc.
2013-11-18 23:41:32 +01:00
Olivier Parcollet
899210ff53 arrays: fix bug in ellipsis when it is of size 0
- a(1,ellipsis()) for a an array<T,1> e.g.,
was not compiling.
- also added const_iterator for range to allow simple code :
  for (auto i : range {3,6}) ....-> i = 3,4,5 as in python
2013-11-18 23:41:32 +01:00
Olivier Parcollet
c151e63de2 arrays : rm old array_proxy
- useless old draft
2013-11-18 23:41:32 +01:00
Olivier Parcollet
1d929c1a91 arrays: add rebind const_view from view
- also add some static assert to forbid += and co on const_view
2013-10-22 21:29:27 +02:00
Olivier Parcollet
dcb1386630 arrays const_matrix_tensor_proxy delete = 2013-10-21 21:53:49 +02:00
Olivier Parcollet
445f7d42e1 arrays: clean dead code 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