diff --git a/vec.cc b/vec.cc index dc16611..c4434cb 100644 --- a/vec.cc +++ b/vec.cc @@ -877,6 +877,9 @@ const NRVec NRVec::subvector(const int from, const int to) const laerror("invalid subvector specification"); } #endif +//trivial case of whole vector for efficiency + if(from==0 && to == nn-1) return *this; + const int n = to - from + 1; NRVec r(n, getlocation()); if(!LA_traits::is_plaindata()) laerror("only implemented for plain data");