diff --git a/test/speed/array1.cpp b/test/speed/array1.cpp index 57225345..263ad379 100644 --- a/test/speed/array1.cpp +++ b/test/speed/array1.cpp @@ -137,8 +137,8 @@ struct foreach_manual_simple { const int u[2] = {1,0}; //=1, u1=0; //int u[2]; for (int i=0; i<2; ++i) u[i] = 1-i; for (int k =0; k<5000; ++k) - for (t[u[0]]=0; t[u[0]] , vector >(); - // does not work for array just because of .size() vs .len(0)... + // does not work for array just because of .size() vs .shape(0)... //test , array >(); //test , vector >(); //test , array >(); diff --git a/triqs/arrays/blas_lapack/stev.hpp b/triqs/arrays/blas_lapack/stev.hpp index 62bf9fd1..1b62eb63 100644 --- a/triqs/arrays/blas_lapack/stev.hpp +++ b/triqs/arrays/blas_lapack/stev.hpp @@ -49,7 +49,7 @@ namespace triqs { namespace arrays { namespace blas { D(range(0,s)) = d; E(range(0,s-1)) = e; int info; - f77::stev ('V',d.size(),D.data_start(),E.data_start(), Z.data_start(), Z.len(0),W.data_start(), info); + f77::stev ('V',d.size(),D.data_start(),E.data_start(), Z.data_start(), Z.shape(0),W.data_start(), info); if (info !=0) TRIQS_RUNTIME_ERROR << " Error in tridiagonal matrix diagonalization "<< info; } arrays::vector_view values() const { return D(range(0,s));} diff --git a/triqs/arrays/impl/indexmap_storage_pair.hpp b/triqs/arrays/impl/indexmap_storage_pair.hpp index 57516bab..37ef7422 100644 --- a/triqs/arrays/impl/indexmap_storage_pair.hpp +++ b/triqs/arrays/impl/indexmap_storage_pair.hpp @@ -166,8 +166,6 @@ namespace triqs { namespace arrays { size_t shape(size_t i) const { return domain().lengths()[i];} - size_t len(size_t i) const { return this->shape()[i]; } - size_t num_elements() const { return domain().number_of_elements();} //bool is_empty() const { return this->num_elements()==0;} diff --git a/triqs/arrays/matrix_stack_view.hpp b/triqs/arrays/matrix_stack_view.hpp index b21e7c36..d5c0242f 100644 --- a/triqs/arrays/matrix_stack_view.hpp +++ b/triqs/arrays/matrix_stack_view.hpp @@ -44,9 +44,9 @@ namespace triqs { namespace arrays { matrix_view view(size_t i) const { return a(i,range(),range());} - size_t size() const { return a.len(0);} - size_t dim0() const { return a.len(1);} - size_t dim1() const { return a.len(2);} + size_t size() const { return a.shape(0);} + size_t dim0() const { return a.shape(1);} + size_t dim1() const { return a.shape(2);} matrix_stack_view & operator +=(matrix_stack_view const & arg) { a += arg.a; return *this; } matrix_stack_view & operator -=(matrix_stack_view const & arg) { a -= arg.a; return *this; } diff --git a/triqs/arrays/matrix_view_proxy.hpp b/triqs/arrays/matrix_view_proxy.hpp index 777388a3..11f25d10 100644 --- a/triqs/arrays/matrix_view_proxy.hpp +++ b/triqs/arrays/matrix_view_proxy.hpp @@ -34,7 +34,7 @@ namespace triqs { namespace arrays { // to do : separate the array and the matrix case. // generalize with preprocessor (draft below) - // write concept mutable down and clean it (dim0, dim1, len(i), ...) + // write concept mutable down and clean it (dim0, dim1, shape(i), ...) #ifdef DO_NOT_DEFINE_ME // human version of the class, the preprocessor generalisation is next.. template class const_matrix_view_proxy : TRIQS_MODEL_CONCEPT(ImmutableMatrix) { @@ -47,9 +47,9 @@ namespace triqs { namespace arrays { typedef typename indexmap_type::domain_type domain_type; indexmap_type indexmap() const { return slicer_t::invoke(A->indexmap() , range() , range(),n, ellipsis()); } domain_type domain() const { return indexmap().domain();} - size_t len(int i) const { return A->len(i);} - size_t dim0() const { return A->len(0);} - size_t dim1() const { return A->len(1);} + size_t shape(int i) const { return A->shape(i);} + size_t dim0() const { return A->shape(0);} + size_t dim1() const { return A->shape(1);} typename ArrayType::storage_type const & storage() const { return A->storage();} TRIQS_DELETE_COMPOUND_OPERATORS(const_matrix_view_proxy); template< typename A0 , typename A1 , typename ... Args> value_type const & operator() ( A0 &&a0 , A1 &&a1 , Args && ... args) const @@ -66,9 +66,9 @@ namespace triqs { namespace arrays { typedef typename indexmap_type::domain_type domain_type; indexmap_type indexmap() const { return slicer_t::invoke(A->indexmap() , range() , range(),n, ellipsis()); } domain_type domain() const { return indexmap().domain();} - size_t len(int i) const { return A->len(i);} - size_t dim0() const { return A->len(0);} - size_t dim1() const { return A->len(1);} + size_t shape(int i) const { return A->shape(i);} + size_t dim0() const { return A->shape(0);} + size_t dim1() const { return A->shape(1);} typename ArrayType::storage_type const & storage() const { return A->storage();} template matrix_view_proxy & operator=(const RHS & X) {triqs_arrays_assign_delegation(*this,X); return *this; } TRIQS_DEFINE_COMPOUND_OPERATORS(matrix_view_proxy); @@ -92,9 +92,9 @@ namespace triqs { namespace arrays { typedef typename indexmap_type::domain_type domain_type;\ indexmap_type indexmap() const { return slicer_t::invoke(A->indexmap() BOOST_PP_ENUM_TRAILING(POS, TEXT, range()),n, ellipsis()); }\ domain_type domain() const { return indexmap().domain();}\ - size_t len(int i) const { return A->len(i);}\ - size_t dim0() const { return A->len((POS+1)%3);}\ - size_t dim1() const { return A->len((POS+2)%3);}\ + size_t shape(int i) const { return A->shape(i);}\ + size_t dim0() const { return A->shape((POS+1)%3);}\ + size_t dim1() const { return A->shape((POS+2)%3);}\ typename ArrayType::storage_type const & storage() const { return A->storage();}\ value_type const * restrict data_start() const { return &storage()[indexmap().start_shift()];}\ value_type * restrict data_start() { return &storage()[indexmap().start_shift()];}\ @@ -117,9 +117,9 @@ namespace triqs { namespace arrays { typedef typename indexmap_type::domain_type domain_type;\ indexmap_type indexmap() const { return slicer_t::invoke(A->indexmap() BOOST_PP_ENUM_TRAILING(POS, TEXT, range()),n, ellipsis()); }\ domain_type domain() const { return indexmap().domain();}\ - size_t len(int i) const { return A->len(i);}\ - size_t dim0() const { return A->len((POS+1)%3);}\ - size_t dim1() const { return A->len((POS+2)%3);}\ + size_t shape(int i) const { return A->shape(i);}\ + size_t dim0() const { return A->shape((POS+1)%3);}\ + size_t dim1() const { return A->shape((POS+2)%3);}\ typename ArrayType::storage_type const & storage() const { return A->storage();}\ value_type const * restrict data_start() const { return &storage()[indexmap().start_shift()];}\ value_type * restrict data_start() { return &storage()[indexmap().start_shift()];}\ diff --git a/triqs/lattice/bravais_lattice_and_brillouin_zone.cpp b/triqs/lattice/bravais_lattice_and_brillouin_zone.cpp index 101e6238..f93df772 100644 --- a/triqs/lattice/bravais_lattice_and_brillouin_zone.cpp +++ b/triqs/lattice/bravais_lattice_and_brillouin_zone.cpp @@ -29,7 +29,7 @@ namespace triqs { namespace lattice_tools { //using triqs::arrays::blas::dot; const double almost_zero(1E-10); - bravais_lattice::bravais_lattice( units_type const & units__) : units_(3,3), dim_(units__.len(0)) { + bravais_lattice::bravais_lattice( units_type const & units__) : units_(3,3), dim_(units__.shape(0)) { units_(range(0,dim_),range()) = units__(); units_(range(dim_,3),range()) = 0; // First complete the basis. Add some tests for safety diff --git a/triqs/lattice/tight_binding.cpp b/triqs/lattice/tight_binding.cpp index 34723b0d..4d357aa8 100644 --- a/triqs/lattice/tight_binding.cpp +++ b/triqs/lattice/tight_binding.cpp @@ -31,8 +31,8 @@ using namespace std; array_view hopping_stack (tight_binding const & TB, array_view const & k_stack) { auto TK = Fourier(TB); - array res(TB.n_bands(), TB.n_bands(), k_stack.len(1)); - for(size_t i = 0; i res(TB.n_bands(), TB.n_bands(), k_stack.shape(1)); + for(size_t i = 0; i dos(neps); // Check consistency const size_t ndim=TB.lattice().dim(); //const size_t norb=TB.lattice().n_orbitals(); if (ndim !=2) TRIQS_RUNTIME_ERROR<<"dos_patch : dimension 2 only !"; - if (triangles.len(1) != ndim) TRIQS_RUNTIME_ERROR<<"dos_patch : the second dimension of the 'triangle' array in not "< V(std::forward(v)); if (v.size() != bl_.dim()) TRIQS_RUNTIME_ERROR<<"tight_binding : displacement of incorrect size : got "<< v.size() << "instead of "<< bl_.dim(); matrix M(std::forward(m)); - if (M.len(0) != n_bands()) TRIQS_RUNTIME_ERROR<<"tight_binding : the first dim matrix is of size "<< M.len(0) <<" instead of "<< n_bands(); - if (M.len(1) != n_bands()) TRIQS_RUNTIME_ERROR<<"tight_binding : the first dim matrix is of size "<< M.len(1) <<" instead of "<< n_bands(); + if (M.shape(0) != n_bands()) TRIQS_RUNTIME_ERROR<<"tight_binding : the first dim matrix is of size "<< M.shape(0) <<" instead of "<< n_bands(); + if (M.shape(1) != n_bands()) TRIQS_RUNTIME_ERROR<<"tight_binding : the first dim matrix is of size "<< M.shape(1) <<" instead of "<< n_bands(); displ_value_stack.push_back(std::make_pair(std::move(V), std::move(M))); }