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() &&
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).
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 !
- 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.
- 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).
- 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, ...
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
- 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
- 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
- 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).
- 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.
- 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