trivial subvector of full size return *this

This commit is contained in:
Jiri Pittner 2025-10-17 14:07:47 +02:00
parent 9ef9ff6630
commit 1dd3905d14

3
vec.cc
View File

@ -877,6 +877,9 @@ const NRVec<T> NRVec<T>::subvector(const int from, const int to) const
laerror("invalid subvector specification"); laerror("invalid subvector specification");
} }
#endif #endif
//trivial case of whole vector for efficiency
if(from==0 && to == nn-1) return *this;
const int n = to - from + 1; const int n = to - from + 1;
NRVec<T> r(n, getlocation()); NRVec<T> r(n, getlocation());
if(!LA_traits<T>::is_plaindata()) laerror("only implemented for plain data"); if(!LA_traits<T>::is_plaindata()) laerror("only implemented for plain data");