- 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
- 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
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 !
- 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).
- 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
- 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.
- 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.