16#if __cplusplus > 201402L
17#define R__RVEC_NODISCARD [[nodiscard]]
19#define R__RVEC_NODISCARD
24 #ifndef _USE_MATH_DEFINES
25 #define _USE_MATH_DEFINES
28 #undef _USE_MATH_DEFINES
30 #define _VECOPS_USE_EXTERN_TEMPLATES false
32 #define _VECOPS_USE_EXTERN_TEMPLATES true
55#include <vdt/vdtMath.h>
80constexpr bool All(
const bool *vals, std::size_t
size)
82 for (
auto i = 0
u; i <
size; ++i)
88template <
typename... T>
91 constexpr const auto nArgs =
sizeof...(T);
92 const std::size_t
sizes[] = {
vs.size()...};
94 for (
auto i = 1UL; i <
nArgs; i++) {
98 msg +=
": input RVec instances have different lengths!";
99 throw std::runtime_error(
msg);
105template <
typename F,
typename...
RVecs>
111 for (
auto i = 0
UL; i <
size; i++)
117template <
typename Tuple_t, std::size_t...
Is>
119 ->
decltype(
MapImpl(std::get<std::tuple_size<Tuple_t>::value - 1>(t), std::get<Is>(t)...))
121 constexpr const auto tupleSizeM1 = std::tuple_size<Tuple_t>::value - 1;
122 return MapImpl(std::get<tupleSizeM1>(t), std::get<Is>(t)...);
154 static constexpr size_t SizeTypeMax() {
return std::numeric_limits<Size_T>::max(); }
162 void grow_pod(
void *FirstEl,
size_t MinSize,
size_t TSize);
166 static void report_size_overflow(
size_t MinSize);
169 static void report_at_maximum_capacity();
172 bool Owns()
const {
return fCapacity != -1; }
191 if (
N > capacity()) {
192 throw std::runtime_error(
"Setting size to a value greater than capacity.");
202 alignas(T)
char FirstEl[
sizeof(T)];
215 return const_cast<void *
>(
reinterpret_cast<const void *
>(
reinterpret_cast<const char *
>(
this) +
227 bool isSmall()
const {
return this->fBeginX == getFirstEl(); }
232 this->fBeginX = getFirstEl();
235 this->
fSize = this->fCapacity = 0;
255 using Base::capacity;
288 throw std::runtime_error(
"`front` called on an empty RVec");
296 throw std::runtime_error(
"`front` called on an empty RVec");
304 throw std::runtime_error(
"`back` called on an empty RVec");
312 throw std::runtime_error(
"`back` called on an empty RVec");
326template <
typename T,
bool = (std::is_trivially_copy_constructible<T>::value) &&
327 (std::is_trivially_move_constructible<T>::value) &&
328 std::is_trivially_destructible<T>::value>
343 template <
typename It1,
typename It2>
346 std::uninitialized_copy(std::make_move_iterator(
I), std::make_move_iterator(E),
Dest);
351 template <
typename It1,
typename It2>
354 std::uninitialized_copy(
I, E,
Dest);
368 this->set_size(this->
size() + 1);
375 ::new ((
void *)this->end()) T(::std::move(
Elt));
376 this->set_size(this->
size() + 1);
381 this->set_size(this->
size() - 1);
387template <
typename T,
bool TriviallyCopyable>
392 if (MinSize > this->SizeTypeMax())
393 this->report_size_overflow(MinSize);
399 if (this->capacity() == this->SizeTypeMax())
400 this->report_at_maximum_capacity();
409 this->uninitialized_move(this->begin(), this->end(),
NewElts);
413 destroy_range(this->begin(), this->end());
416 if (!this->isSmall())
440 template <
typename It1,
typename It2>
444 uninitialized_copy(
I, E,
Dest);
449 template <
typename It1,
typename It2>
453 std::uninitialized_copy(
I, E,
Dest);
458 template <
typename T1,
typename T2>
461 typename std::enable_if<std::is_same<
typename std::remove_const<T1>::type,
T2>
::value>
::type * =
nullptr)
468 memcpy(
reinterpret_cast<void *
>(
Dest),
I, (E -
I) *
sizeof(T));
475 this->grow_pod(MinSize,
sizeof(T));
488 memcpy(
reinterpret_cast<void *
>(this->end()), &
Elt,
sizeof(T));
489 this->set_size(this->
size() + 1);
497template <
typename T,
unsigned N>
499 alignas(T)
char InlineElts[
N *
sizeof(T)]{};
515#ifdef R__HAS_HARDWARE_INTERFERENCE_SIZE
516 static constexpr std::size_t cacheLineSize = std::hardware_destructive_interference_size;
519 static constexpr std::size_t cacheLineSize = 64;
521 static constexpr unsigned elementsPerCacheLine = (cacheLineSize -
sizeof(
SmallVectorBase)) /
sizeof(T);
522 static constexpr unsigned maxInlineByteSize = 1024;
526 elementsPerCacheLine >= 8 ? elementsPerCacheLine : (
sizeof(T) * 8 > maxInlineByteSize ? 0 : 8);
530template <
typename ForwardIt>
533#if __cplusplus < 201703L
534 for (; first != last; ++first)
535 new (
static_cast<void *
>(std::addressof(*first)))
typename std::iterator_traits<ForwardIt>::value_type();
537 std::uninitialized_value_construct(first, last);
573 explicit RVecImpl(
unsigned N) :
ROOT::Internal::VecOps::SmallVectorTemplateBase<T>(
N) {}
582 if (!this->isSmall() && this->Owns())
590 this->destroy_range(this->begin(), this->end());
593 this->resetToSmall();
601 this->destroy_range(this->begin() +
N, this->end());
603 }
else if (
N > this->
size()) {
604 if (this->capacity() <
N)
606 for (
auto I = this->end(), E = this->begin() +
N;
I != E; ++
I)
616 this->destroy_range(this->begin() +
N, this->end());
618 }
else if (
N > this->
size()) {
619 if (this->capacity() <
N)
621 std::uninitialized_fill(this->end(), this->begin() +
N,
NV);
628 if (this->capacity() <
N)
634 if (this->
size() < NumItems) {
635 throw std::runtime_error(
"Popping back more elements than those available.");
638 this->destroy_range(this->end() - NumItems, this->end());
639 this->set_size(this->
size() - NumItems);
644 T Result = ::std::move(this->back());
653 typename =
typename std::enable_if<std::is_convertible<
654 typename std::iterator_traits<in_iter>::iterator_category, std::input_iterator_tag>
::value>
::type>
659 this->grow(this->
size() + NumInputs);
662 this->set_size(this->
size() + NumInputs);
669 this->grow(this->
size() + NumInputs);
672 this->set_size(this->
size() + NumInputs);
684 if (this->capacity() <
NumElts)
687 std::uninitialized_fill(this->begin(), this->end(),
Elt);
691 typename =
typename std::enable_if<std::is_convertible<
692 typename std::iterator_traits<in_iter>::iterator_category, std::input_iterator_tag>
::value>
::type>
711 throw std::runtime_error(
"The iterator passed to `erase` is out of bounds.");
716 std::move(
I + 1, this->end(),
I);
728 if (
S < this->begin() || E > this->end() || S > E) {
729 throw std::runtime_error(
"Invalid start/end pair passed to `erase` (out of bounds or start > end).");
734 iterator I = std::move(E, this->end(), S);
737 this->destroy_range(
I, this->end());
738 this->set_size(
I - this->begin());
744 if (
I == this->end()) {
745 this->push_back(::std::move(
Elt));
746 return this->end() - 1;
750 throw std::runtime_error(
"The iterator passed to `insert` is out of bounds.");
753 if (this->
size() >= this->capacity()) {
754 size_t EltNo =
I - this->begin();
756 I = this->begin() +
EltNo;
759 ::new ((
void *)this->end()) T(::std::move(this->back()));
761 std::move_backward(
I, this->end() - 1, this->end());
762 this->set_size(this->
size() + 1);
776 if (
I == this->end()) {
777 this->push_back(
Elt);
778 return this->end() - 1;
782 throw std::runtime_error(
"The iterator passed to `insert` is out of bounds.");
785 if (this->
size() >= this->capacity()) {
786 size_t EltNo =
I - this->begin();
788 I = this->begin() +
EltNo;
790 ::new ((
void *)this->end()) T(std::move(this->back()));
792 std::move_backward(
I, this->end() - 1, this->end());
793 this->set_size(this->
size() + 1);
810 if (
I == this->end()) {
816 throw std::runtime_error(
"The iterator passed to `insert` is out of bounds.");
820 reserve(this->
size() + NumToInsert);
831 append(std::move_iterator<iterator>(this->end() -
NumToInsert), std::move_iterator<iterator>(this->end()));
845 this->set_size(this->
size() + NumToInsert);
857 template <
typename ItTy,
858 typename =
typename std::enable_if<std::is_convertible<
859 typename std::iterator_traits<ItTy>::iterator_category, std::input_iterator_tag>
::value>
::type>
865 if (
I == this->end()) {
871 throw std::runtime_error(
"The iterator passed to `insert` is out of bounds.");
877 reserve(this->
size() + NumToInsert);
888 append(std::move_iterator<iterator>(this->end() -
NumToInsert), std::move_iterator<iterator>(this->end()));
902 this->set_size(this->
size() + NumToInsert);
925 ::new ((
void *)this->end()) T(std::forward<ArgTypes>(Args)...);
926 this->set_size(this->
size() + 1);
942 if (!this->isSmall() && !
RHS.isSmall()) {
943 std::swap(this->fBeginX,
RHS.fBeginX);
944 std::swap(this->
fSize, RHS.fSize);
945 std::swap(this->fCapacity,
RHS.fCapacity);
951 if (this->isSmall() && !
RHS.Owns()) {
953 temp = std::move(
RHS);
954 RHS = std::move(*
this);
955 *
this = std::move(temp);
957 }
else if (
RHS.isSmall() && !
this->Owns()) {
959 temp = std::move(*
this);
960 *
this = std::move(
RHS);
961 RHS = std::move(temp);
965 if (
RHS.size() >
this->capacity())
966 this->grow(
RHS.size());
967 if (this->
size() > RHS.capacity())
972 if (NumShared >
RHS.size())
975 std::iter_swap(this->begin() + i,
RHS.
begin() + i);
978 if (this->
size() > RHS.size()) {
980 this->uninitialized_copy(this->begin() +
NumShared, this->end(),
RHS.
end());
983 this->destroy_range(this->begin() +
NumShared, this->end());
985 }
else if (
RHS.size() >
this->size()) {
988 this->set_size(this->
size() + EltDiff);
1016 this->destroy_range(
NewEnd, this->end());
1027 if (this->capacity() <
RHSSize) {
1030 this->destroy_range(this->begin(), this->end());
1048template <
typename T>
1056 if (!
RHS.isSmall()) {
1058 this->destroy_range(this->begin(), this->end());
1059 if (!this->isSmall())
1060 free(this->begin());
1062 this->fBeginX =
RHS.fBeginX;
1064 this->fCapacity =
RHS.fCapacity;
1081 this->destroy_range(
NewEnd, this->end());
1095 if (this->capacity() <
RHSSize) {
1098 this->destroy_range(this->begin(), this->end());
1118template <
typename T>
1124template <
typename T>
1151template <
typename T,
unsigned int N>
1160 this->destroy_range(this->begin(), this->end());
1164 explicit RVecN(
size_t Size,
const T &
Value) : Detail::VecOps::RVecImpl<T>(
N) { this->assign(Size,
Value); }
1166 explicit RVecN(
size_t Size) : Detail::VecOps::RVecImpl<T>(
N)
1174 template <
typename ItTy,
1175 typename =
typename std::enable_if<std::is_convertible<
1176 typename std::iterator_traits<ItTy>::iterator_category, std::input_iterator_tag>
::value>
::type>
1182 RVecN(std::initializer_list<T>
IL) : Detail::VecOps::RVecImpl<T>(
N) { this->assign(
IL); }
1220 this->fCapacity = -1;
1244 return begin()[idx];
1249 return begin()[idx];
1257 if (
n != this->
size()) {
1258 std::string
msg =
"Cannot index RVecN of size " + std::to_string(this->
size()) +
1259 " with condition vector of different size (" + std::to_string(
n) +
").";
1260 throw std::runtime_error(
msg);
1272 ret.push_back(this->
operator[](i));
1289 std::string
msg =
"RVecN::at: size is " + std::to_string(this->
fSize) +
" but out-of-bounds index " +
1290 std::to_string(pos) +
" was requested.";
1291 throw std::out_of_range(
msg);
1293 return this->operator[](pos);
1299 std::string
msg =
"RVecN::at: size is " + std::to_string(this->
fSize) +
" but out-of-bounds index " +
1300 std::to_string(pos) +
" was requested.";
1301 throw std::out_of_range(
msg);
1303 return this->operator[](pos);
1311 return this->operator[](pos);
1319 return this->operator[](pos);
1529template <
typename T>
1540 using SuperClass::begin;
1541 using SuperClass::size;
1549 template <
typename ItTy,
1550 typename =
typename std::enable_if<std::is_convertible<
1551 typename std::iterator_traits<ItTy>::iterator_category, std::input_iterator_tag>
::value>
::type>
1562 SuperClass::operator=(
RHS);
1570 SuperClass::operator=(std::move(
RHS));
1576 template <
unsigned N>
1579 template <
unsigned N>
1590 return RVec<U>(this->begin(), this->end());
1593 using SuperClass::operator[];
1598 return RVec(SuperClass::operator[](
conds));
1601 using SuperClass::at;
1603 friend bool ROOT::Detail::VecOps::IsSmall<T>(
const RVec<T> &
v);
1605 friend bool ROOT::Detail::VecOps::IsAdopting<T>(
const RVec<T> &
v);
1608template <
typename T,
unsigned N>
1611 return X.capacity_in_bytes();
1617#define RVEC_UNARY_OPERATOR(OP) \
1618template <typename T> \
1619RVec<T> operator OP(const RVec<T> &v) \
1622 for (auto &x : ret) \
1631#undef RVEC_UNARY_OPERATOR
1637#define ERROR_MESSAGE(OP) \
1638 "Cannot call operator " #OP " on vectors of different sizes."
1640#define RVEC_BINARY_OPERATOR(OP) \
1641template <typename T0, typename T1> \
1642auto operator OP(const RVec<T0> &v, const T1 &y) \
1643 -> RVec<decltype(v[0] OP y)> \
1645 RVec<decltype(v[0] OP y)> ret(v.size()); \
1646 auto op = [&y](const T0 &x) { return x OP y; }; \
1647 std::transform(v.begin(), v.end(), ret.begin(), op); \
1651template <typename T0, typename T1> \
1652auto operator OP(const T0 &x, const RVec<T1> &v) \
1653 -> RVec<decltype(x OP v[0])> \
1655 RVec<decltype(x OP v[0])> ret(v.size()); \
1656 auto op = [&x](const T1 &y) { return x OP y; }; \
1657 std::transform(v.begin(), v.end(), ret.begin(), op); \
1661template <typename T0, typename T1> \
1662auto operator OP(const RVec<T0> &v0, const RVec<T1> &v1) \
1663 -> RVec<decltype(v0[0] OP v1[0])> \
1665 if (v0.size() != v1.size()) \
1666 throw std::runtime_error(ERROR_MESSAGE(OP)); \
1668 RVec<decltype(v0[0] OP v1[0])> ret(v0.size()); \
1669 auto op = [](const T0 &x, const T1 &y) { return x OP y; }; \
1670 std::transform(v0.begin(), v0.end(), v1.begin(), ret.begin(), op); \
1682#undef RVEC_BINARY_OPERATOR
1688#define RVEC_ASSIGNMENT_OPERATOR(OP) \
1689template <typename T0, typename T1> \
1690RVec<T0>& operator OP(RVec<T0> &v, const T1 &y) \
1692 auto op = [&y](T0 &x) { return x OP y; }; \
1693 std::transform(v.begin(), v.end(), v.begin(), op); \
1697template <typename T0, typename T1> \
1698RVec<T0>& operator OP(RVec<T0> &v0, const RVec<T1> &v1) \
1700 if (v0.size() != v1.size()) \
1701 throw std::runtime_error(ERROR_MESSAGE(OP)); \
1703 auto op = [](T0 &x, const T1 &y) { return x OP y; }; \
1704 std::transform(v0.begin(), v0.end(), v1.begin(), v0.begin(), op); \
1718#undef RVEC_ASSIGNMENT_OPERATOR
1724#define RVEC_LOGICAL_OPERATOR(OP) \
1725template <typename T0, typename T1> \
1726auto operator OP(const RVec<T0> &v, const T1 &y) \
1729 RVec<int> ret(v.size()); \
1730 auto op = [y](const T0 &x) -> int { return x OP y; }; \
1731 std::transform(v.begin(), v.end(), ret.begin(), op); \
1735template <typename T0, typename T1> \
1736auto operator OP(const T0 &x, const RVec<T1> &v) \
1739 RVec<int> ret(v.size()); \
1740 auto op = [x](const T1 &y) -> int { return x OP y; }; \
1741 std::transform(v.begin(), v.end(), ret.begin(), op); \
1745template <typename T0, typename T1> \
1746auto operator OP(const RVec<T0> &v0, const RVec<T1> &v1) \
1749 if (v0.size() != v1.size()) \
1750 throw std::runtime_error(ERROR_MESSAGE(OP)); \
1752 RVec<int> ret(v0.size()); \
1753 auto op = [](const T0 &x, const T1 &y) -> int { return x OP y; }; \
1754 std::transform(v0.begin(), v0.end(), v1.begin(), ret.begin(), op); \
1766#undef RVEC_LOGICAL_OPERATOR
1781template <
typename T>
1784template <
typename U,
typename V>
1789#define RVEC_UNARY_FUNCTION(NAME, FUNC) \
1790 template <typename T> \
1791 RVec<PromoteType<T>> NAME(const RVec<T> &v) \
1793 RVec<PromoteType<T>> ret(v.size()); \
1794 auto f = [](const T &x) { return FUNC(x); }; \
1795 std::transform(v.begin(), v.end(), ret.begin(), f); \
1799#define RVEC_BINARY_FUNCTION(NAME, FUNC) \
1800 template <typename T0, typename T1> \
1801 RVec<PromoteTypes<T0, T1>> NAME(const T0 &x, const RVec<T1> &v) \
1803 RVec<PromoteTypes<T0, T1>> ret(v.size()); \
1804 auto f = [&x](const T1 &y) { return FUNC(x, y); }; \
1805 std::transform(v.begin(), v.end(), ret.begin(), f); \
1809 template <typename T0, typename T1> \
1810 RVec<PromoteTypes<T0, T1>> NAME(const RVec<T0> &v, const T1 &y) \
1812 RVec<PromoteTypes<T0, T1>> ret(v.size()); \
1813 auto f = [&y](const T0 &x) { return FUNC(x, y); }; \
1814 std::transform(v.begin(), v.end(), ret.begin(), f); \
1818 template <typename T0, typename T1> \
1819 RVec<PromoteTypes<T0, T1>> NAME(const RVec<T0> &v0, const RVec<T1> &v1) \
1821 if (v0.size() != v1.size()) \
1822 throw std::runtime_error(ERROR_MESSAGE(NAME)); \
1824 RVec<PromoteTypes<T0, T1>> ret(v0.size()); \
1825 auto f = [](const T0 &x, const T1 &y) { return FUNC(x, y); }; \
1826 std::transform(v0.begin(), v0.end(), v1.begin(), ret.begin(), f); \
1830#define RVEC_STD_UNARY_FUNCTION(F) RVEC_UNARY_FUNCTION(F, std::F)
1831#define RVEC_STD_BINARY_FUNCTION(F) RVEC_BINARY_FUNCTION(F, std::F)
1878#undef RVEC_STD_UNARY_FUNCTION
1885#define RVEC_VDT_UNARY_FUNCTION(F) RVEC_UNARY_FUNCTION(F, vdt::F)
1904#undef RVEC_VDT_UNARY_FUNCTION
1908#undef RVEC_UNARY_FUNCTION
1923template <
typename T,
typename V>
1926 if (
v0.size() !=
v1.size())
1927 throw std::runtime_error(
"Cannot compute inner product of vectors of different sizes");
1928 return std::inner_product(
v0.begin(),
v0.end(),
v1.begin(),
decltype(
v0[0] *
v1[0])(0));
1954template <
typename T>
1957 return std::accumulate(
v.begin(),
v.end(),
zero);
1962 return std::accumulate(
v.begin(),
v.end(),
zero);
1966template <
typename T>
1969 return std::accumulate(
v.begin(),
v.end(), init, std::multiplies<T>());
1984template <
typename T>
1987 if (
v.empty())
return 0.;
2016template <
typename T,
typename R = T>
2019 if (
v.empty())
return zero;
2033template <
typename T>
2036 return *std::max_element(
v.begin(),
v.end());
2049template <
typename T>
2052 return *std::min_element(
v.begin(),
v.end());
2067template <
typename T>
2070 return std::distance(
v.begin(), std::max_element(
v.begin(),
v.end()));
2085template <
typename T>
2088 return std::distance(
v.begin(), std::min_element(
v.begin(),
v.end()));
2102template <
typename T>
2105 const std::size_t
size =
v.size();
2106 if (
size < std::size_t(2))
return 0.;
2109 std::for_each(
v.begin(),
v.end(),
pred);
2126template <
typename T>
2129 return std::sqrt(Var(
v));
2150template <
typename... Args>
2163 constexpr auto nArgs =
sizeof...(Args);
2166 "Map: the first N-1 arguments must be RVecs or references to RVecs");
2169 std::make_index_sequence<
sizeof...(args) - 1>());
2182template <
typename T,
typename F>
2188 for (
auto &&val :
v) {
2190 w.emplace_back(val);
2205template <
typename T>
2209 if (
static_cast<bool>(
e) ==
true)
2224template <
typename T>
2228 if (
static_cast<bool>(
e) ==
false)
2233template <
typename T>
2250template <
typename T>
2256 std::sort(i.
begin(), i.
end(), [&
v](size_type
i1, size_type
i2) { return v[i1] < v[i2]; });
2271template <
typename T,
typename Compare>
2278 [&
v, &
c](size_type
i1, size_type
i2) { return c(v[i1], v[i2]); });
2295template <
typename T>
2301 std::stable_sort(i.
begin(), i.
end(), [&
v](size_type
i1, size_type
i2) { return v[i1] < v[i2]; });
2318template <
typename T,
typename Compare>
2324 std::stable_sort(i.
begin(), i.
end(), [&
v, &
c](size_type
i1, size_type
i2) { return c(v[i1], v[i2]); });
2339template <
typename T>
2343 const size_type
isize = i.size();
2345 for (size_type k = 0; k <
isize; k++)
2351template <
typename T>
2355 const size_type
isize = i.size();
2357 for (size_type k = 0; k <
isize; k++)
2359 if (i[k] <
v.size() && i[k]>=0){
2382template <
typename T>
2386 const size_type
size =
v.size();
2387 const size_type
absn = std::abs(
n);
2389 const auto msg = std::to_string(
absn) +
" elements requested from Take but input contains only " +
2390 std::to_string(
size) +
" elements.";
2391 throw std::runtime_error(
msg);
2395 for (size_type k = 0; k <
absn; k++)
2398 for (size_type k = 0; k <
absn; k++)
2423template <
typename T>
2427 const size_type
size =
v.size();
2428 const size_type
absn = std::abs(
n);
2448template <
typename T>
2456 if (
v.size() >
idxs.size())
2457 r.reserve(
v.size() -
idxs.size());
2461 for (
sz_t i = 0
u; i <
v.size(); ++i) {
2465 r.emplace_back(
v[i]);
2481template <
typename T>
2485 std::reverse(
r.begin(),
r.end());
2502template <
typename T>
2506 std::sort(
r.begin(),
r.end());
2527template <
typename T,
typename Compare>
2531 std::sort(
r.begin(),
r.end(), std::forward<Compare>(
c));
2551template <
typename T>
2555 std::stable_sort(
r.begin(),
r.end());
2587template <
typename T,
typename Compare>
2591 std::stable_sort(
r.begin(),
r.end(), std::forward<Compare>(
c));
2609 using size_type = std::size_t;
2614 for(size_type i=0; i<
size1; i++) {
2638template <
typename T1,
typename T2>
2663template <
typename T>
2667 const size_type s =
v.size();
2669 throw std::runtime_error(
"Cannot make unique combinations of size " + std::to_string(
n) +
2670 " from vector of size " + std::to_string(s) +
".");
2674 for(size_type k=0; k<s; k++)
2679 for (size_type
m = s -
n + 2;
m <= s; ++
m)
2682 size_type
factn = 1;
2683 for (size_type i = 2; i <=
n; ++i)
2692 for (size_type k = 0; k <
n; k++)
2709 for (
long j=i+1;
j<(long)
n;
j++)
2711 for (size_type k = 0; k <
n; k++)
2727template <
typename T>
2732 const auto size =
v.size();
2734 for(size_type i=0; i<
size; i++) {
2758template <
typename T>
2766 const auto size =
v1.size();
2769 for(size_type i=0; i<
size; i++) {
2771 r.emplace_back(
v1[i]);
2792template <
typename T>
2796 const size_type
size =
c.size();
2799 for (size_type i=0; i<
size; i++) {
2800 r.emplace_back(
c[i] != 0 ?
v1[i] :
v2[i]);
2820template <
typename T>
2824 const size_type
size =
c.size();
2827 for (size_type i=0; i<
size; i++) {
2828 r.emplace_back(
c[i] != 0 ?
v1[i] :
v2);
2848template <
typename T>
2852 const size_type
size =
c.size();
2855 for (size_type i=0; i<
size; i++) {
2856 r.emplace_back(
c[i] != 0 ?
v1 :
v2[i]);
2874template <
typename T>
2878 const size_type
size =
c.size();
2881 for (size_type i=0; i<
size; i++) {
2882 r.emplace_back(
c[i] != 0 ?
v1 :
v2);
2901 res.reserve(
v0.size() +
v1.size());
2902 std::copy(
v0.begin(),
v0.end(), std::back_inserter(res));
2903 std::copy(
v1.begin(),
v1.end(), std::back_inserter(res));
2913template <
typename T0,
typename T1 = T0,
typename Common_t = std::common_type_t<T0, T1>>
2916 static_assert(std::is_floating_point<T0>::value && std::is_floating_point<T1>::value,
2917 "DeltaPhi must be called with floating point values.");
2918 auto r = std::fmod(
v2 -
v1, 2.0 *
c);
2934template <
typename T0,
typename T1 = T0,
typename Common_t =
typename std::common_type_t<T0, T1>>
2938 const size_type
size =
v1.size();
2940 for (size_type i = 0; i <
size; i++) {
2941 r[i] = DeltaPhi(
v1[i],
v2[i],
c);
2952template <
typename T0,
typename T1 = T0,
typename Common_t =
typename std::common_type_t<T0, T1>>
2956 const size_type
size =
v1.size();
2958 for (size_type i = 0; i <
size; i++) {
2959 r[i] = DeltaPhi(
v1[i],
v2,
c);
2970template <
typename T0,
typename T1 = T0,
typename Common_t =
typename std::common_type_t<T0, T1>>
2974 const size_type
size =
v2.size();
2976 for (size_type i = 0; i <
size; i++) {
2977 r[i] = DeltaPhi(
v1,
v2[i],
c);
2989template <
typename T0,
typename T1 = T0,
typename T2 = T0,
typename T3 = T0,
typename Common_t = std::common_type_t<T0, T1, T2, T3>>
3003template <
typename T0,
typename T1 = T0,
typename T2 = T0,
typename T3 = T0,
typename Common_t = std::common_type_t<T0, T1, T2, T3>>
3016template <
typename T0,
typename T1 = T0,
typename T2 = T0,
typename T3 = T0,
typename Common_t = std::common_type_t<T0, T1, T2, T3>>
3028template <
typename T0,
typename T1 =
T0,
typename T2 =
T0,
typename T3 =
T0,
typename T4 =
T0,
3029 typename T5 =
T0,
typename Common_t = std::common_type_t<T0, T1>>
3042 return std::atan2(
c,
d);
3050template <
typename T0,
typename T1 =
T0,
typename T2 =
T0,
typename T3 =
T0,
typename T4 =
T0,
3051 typename T5 =
T0,
typename T6 =
T0,
typename T7 =
T0,
typename Common_t = std::common_type_t<T0, T1, T2, T3, T4, T5, T6, T7>>
3062 return (
mass1 + mass2);
3064 auto mm =
mass1 + std::sqrt(mass2*mass2 +
p2_sq);
3065 auto m2 = mm*mm -
p2_sq;
3067 return std::sqrt( m2 );
3069 return std::sqrt( -m2 );
3073 auto m2 = mm*mm -
p1_sq;
3075 return std::sqrt( m2 );
3077 return std::sqrt( -m2 );
3081 const auto m2_sq = mass2 * mass2;
3087 const auto cos_a = std::cos(
a);
3090 y = (
x + std::sin(
a) * std::sin(
a)) / (std::sqrt(
x + 1) +
cos_a);
3106template <
typename T0,
typename T1 =
T0,
typename T2 =
T0,
typename T3 =
T0,
typename T4 =
T0,
3107 typename T5 =
T0,
typename T6 =
T0,
typename T7 =
T0,
typename Common_t = std::common_type_t<T0, T1, T2, T3, T4, T5, T6, T7>>
3112 std::size_t
size = px1.size();
3119 for (std::size_t i = 0
u; i <
size; ++i) {
3132template <
typename T0,
typename T1 =
T0,
typename T2 =
T0,
typename T3 =
T0,
typename T4 =
T0,
3133 typename T5 =
T0,
typename T6 =
T0,
typename T7 =
T0,
typename Common_t = std::common_type_t<T0, T1, T2, T3, T4, T5, T6, T7>>
3138 std::size_t
size =
pt1.size();
3145 for (std::size_t i = 0
u; i <
size; ++i) {
3147 const auto x1 =
pt1[i] * std::cos(
phi1[i]);
3148 const auto y1 =
pt1[i] * std::sin(
phi1[i]);
3149 const auto z1 =
pt1[i] * std::sinh(
eta1[i]);
3151 const auto x2 =
pt2[i] * std::cos(
phi2[i]);
3152 const auto y2 =
pt2[i] * std::sin(
phi2[i]);
3153 const auto z2 =
pt2[i] * std::sinh(
eta2[i]);
3168template <
typename T0,
typename T1 = T0,
typename T2 = T0,
typename T3 = T0,
typename Common_t = std::common_type_t<T0, T1, T2, T3>>
3171 const std::size_t
size =
pt.size();
3180 for (std::size_t i = 0
u; i <
size; ++ i) {
3182 const auto x =
pt[i] * std::cos(phi[i]);
3184 const auto y =
pt[i] * std::sin(phi[i]);
3186 const auto z =
pt[i] * std::sinh(eta[i]);
3188 const auto e = std::sqrt(
x *
x +
y *
y + z * z + mass[i] * mass[i]);
3214template <
typename T,
typename...
Args_t>
3220 for (
auto i = 0
UL; i <
size; ++i) {
3221 ret.emplace_back(args[i]...);
3234template <
typename T>
3237 const auto size =
v.size();
3240 for (
auto i = 0
UL; i <
size; ++i) {
3241 ret.emplace_back(i);
3257 for (
auto i = 0
UL; i <
length; ++i) {
3258 ret.emplace_back(i);
3268 ret.reserve(begin < end ? end - begin : 0
u);
3269 for (
auto i = begin; i < end; ++i)
3290 throw std::runtime_error(
"Range: the stride must not be zero");
3293 float ret_cap = std::ceil(
static_cast<float>(end-begin) /
stride);
3302 for (
auto i = begin; i < end; i+=
stride)
3307 for (
auto i = begin; i > end; i+=
stride)
3319 constexpr bool mustConvert = std::is_same<char, T>::value || std::is_same<signed char, T>::value ||
3320 std::is_same<unsigned char, T>::value || std::is_same<wchar_t, T>::value ||
3321 std::is_same<char16_t, T>::value || std::is_same<char32_t, T>::value;
3322 using Print_t =
typename std::conditional<mustConvert, long long int, T>::type;
3324 auto size =
v.size();
3326 for (std::size_t i = 0; i <
size - 1; ++i) {
3335#if (_VECOPS_USE_EXTERN_TEMPLATES)
3337#define RVEC_EXTERN_UNARY_OPERATOR(T, OP) \
3338 extern template RVec<T> operator OP<T>(const RVec<T> &);
3340#define RVEC_EXTERN_BINARY_OPERATOR(T, OP) \
3341 extern template auto operator OP<T, T>(const T &x, const RVec<T> &v) \
3342 -> RVec<decltype(x OP v[0])>; \
3343 extern template auto operator OP<T, T>(const RVec<T> &v, const T &y) \
3344 -> RVec<decltype(v[0] OP y)>; \
3345 extern template auto operator OP<T, T>(const RVec<T> &v0, const RVec<T> &v1)\
3346 -> RVec<decltype(v0[0] OP v1[0])>;
3348#define RVEC_EXTERN_ASSIGN_OPERATOR(T, OP) \
3349 extern template RVec<T> &operator OP<T, T>(RVec<T> &, const T &); \
3350 extern template RVec<T> &operator OP<T, T>(RVec<T> &, const RVec<T> &);
3352#define RVEC_EXTERN_LOGICAL_OPERATOR(T, OP) \
3353 extern template RVec<int> operator OP<T, T>(const RVec<T> &, const T &); \
3354 extern template RVec<int> operator OP<T, T>(const T &, const RVec<T> &); \
3355 extern template RVec<int> operator OP<T, T>(const RVec<T> &, const RVec<T> &);
3357#define RVEC_EXTERN_FLOAT_TEMPLATE(T) \
3358 extern template class RVec<T>; \
3359 RVEC_EXTERN_UNARY_OPERATOR(T, +) \
3360 RVEC_EXTERN_UNARY_OPERATOR(T, -) \
3361 RVEC_EXTERN_UNARY_OPERATOR(T, !) \
3362 RVEC_EXTERN_BINARY_OPERATOR(T, +) \
3363 RVEC_EXTERN_BINARY_OPERATOR(T, -) \
3364 RVEC_EXTERN_BINARY_OPERATOR(T, *) \
3365 RVEC_EXTERN_BINARY_OPERATOR(T, /) \
3366 RVEC_EXTERN_ASSIGN_OPERATOR(T, +=) \
3367 RVEC_EXTERN_ASSIGN_OPERATOR(T, -=) \
3368 RVEC_EXTERN_ASSIGN_OPERATOR(T, *=) \
3369 RVEC_EXTERN_ASSIGN_OPERATOR(T, /=) \
3370 RVEC_EXTERN_LOGICAL_OPERATOR(T, <) \
3371 RVEC_EXTERN_LOGICAL_OPERATOR(T, >) \
3372 RVEC_EXTERN_LOGICAL_OPERATOR(T, ==) \
3373 RVEC_EXTERN_LOGICAL_OPERATOR(T, !=) \
3374 RVEC_EXTERN_LOGICAL_OPERATOR(T, <=) \
3375 RVEC_EXTERN_LOGICAL_OPERATOR(T, >=) \
3376 RVEC_EXTERN_LOGICAL_OPERATOR(T, &&) \
3377 RVEC_EXTERN_LOGICAL_OPERATOR(T, ||)
3379#define RVEC_EXTERN_INTEGER_TEMPLATE(T) \
3380 extern template class RVec<T>; \
3381 RVEC_EXTERN_UNARY_OPERATOR(T, +) \
3382 RVEC_EXTERN_UNARY_OPERATOR(T, -) \
3383 RVEC_EXTERN_UNARY_OPERATOR(T, ~) \
3384 RVEC_EXTERN_UNARY_OPERATOR(T, !) \
3385 RVEC_EXTERN_BINARY_OPERATOR(T, +) \
3386 RVEC_EXTERN_BINARY_OPERATOR(T, -) \
3387 RVEC_EXTERN_BINARY_OPERATOR(T, *) \
3388 RVEC_EXTERN_BINARY_OPERATOR(T, /) \
3389 RVEC_EXTERN_BINARY_OPERATOR(T, %) \
3390 RVEC_EXTERN_BINARY_OPERATOR(T, &) \
3391 RVEC_EXTERN_BINARY_OPERATOR(T, |) \
3392 RVEC_EXTERN_BINARY_OPERATOR(T, ^) \
3393 RVEC_EXTERN_ASSIGN_OPERATOR(T, +=) \
3394 RVEC_EXTERN_ASSIGN_OPERATOR(T, -=) \
3395 RVEC_EXTERN_ASSIGN_OPERATOR(T, *=) \
3396 RVEC_EXTERN_ASSIGN_OPERATOR(T, /=) \
3397 RVEC_EXTERN_ASSIGN_OPERATOR(T, %=) \
3398 RVEC_EXTERN_ASSIGN_OPERATOR(T, &=) \
3399 RVEC_EXTERN_ASSIGN_OPERATOR(T, |=) \
3400 RVEC_EXTERN_ASSIGN_OPERATOR(T, ^=) \
3401 RVEC_EXTERN_ASSIGN_OPERATOR(T, >>=) \
3402 RVEC_EXTERN_ASSIGN_OPERATOR(T, <<=) \
3403 RVEC_EXTERN_LOGICAL_OPERATOR(T, <) \
3404 RVEC_EXTERN_LOGICAL_OPERATOR(T, >) \
3405 RVEC_EXTERN_LOGICAL_OPERATOR(T, ==) \
3406 RVEC_EXTERN_LOGICAL_OPERATOR(T, !=) \
3407 RVEC_EXTERN_LOGICAL_OPERATOR(T, <=) \
3408 RVEC_EXTERN_LOGICAL_OPERATOR(T, >=) \
3409 RVEC_EXTERN_LOGICAL_OPERATOR(T, &&) \
3410 RVEC_EXTERN_LOGICAL_OPERATOR(T, ||)
3427#undef RVEC_EXTERN_UNARY_OPERATOR
3428#undef RVEC_EXTERN_BINARY_OPERATOR
3429#undef RVEC_EXTERN_ASSIGN_OPERATOR
3430#undef RVEC_EXTERN_LOGICAL_OPERATOR
3431#undef RVEC_EXTERN_INTEGER_TEMPLATE
3432#undef RVEC_EXTERN_FLOAT_TEMPLATE
3434#define RVEC_EXTERN_UNARY_FUNCTION(T, NAME, FUNC) \
3435 extern template RVec<PromoteType<T>> NAME(const RVec<T> &);
3437#define RVEC_EXTERN_STD_UNARY_FUNCTION(T, F) RVEC_EXTERN_UNARY_FUNCTION(T, F, std::F)
3439#define RVEC_EXTERN_BINARY_FUNCTION(T0, T1, NAME, FUNC) \
3440 extern template RVec<PromoteTypes<T0, T1>> NAME(const RVec<T0> &, const T1 &); \
3441 extern template RVec<PromoteTypes<T0, T1>> NAME(const T0 &, const RVec<T1> &); \
3442 extern template RVec<PromoteTypes<T0, T1>> NAME(const RVec<T0> &, const RVec<T1> &);
3444#define RVEC_EXTERN_STD_BINARY_FUNCTION(T, F) RVEC_EXTERN_BINARY_FUNCTION(T, T, F, std::F)
3446#define RVEC_EXTERN_STD_FUNCTIONS(T) \
3447 RVEC_EXTERN_STD_UNARY_FUNCTION(T, abs) \
3448 RVEC_EXTERN_STD_BINARY_FUNCTION(T, fdim) \
3449 RVEC_EXTERN_STD_BINARY_FUNCTION(T, fmod) \
3450 RVEC_EXTERN_STD_BINARY_FUNCTION(T, remainder) \
3451 RVEC_EXTERN_STD_UNARY_FUNCTION(T, exp) \
3452 RVEC_EXTERN_STD_UNARY_FUNCTION(T, exp2) \
3453 RVEC_EXTERN_STD_UNARY_FUNCTION(T, expm1) \
3454 RVEC_EXTERN_STD_UNARY_FUNCTION(T, log) \
3455 RVEC_EXTERN_STD_UNARY_FUNCTION(T, log10) \
3456 RVEC_EXTERN_STD_UNARY_FUNCTION(T, log2) \
3457 RVEC_EXTERN_STD_UNARY_FUNCTION(T, log1p) \
3458 RVEC_EXTERN_STD_BINARY_FUNCTION(T, pow) \
3459 RVEC_EXTERN_STD_UNARY_FUNCTION(T, sqrt) \
3460 RVEC_EXTERN_STD_UNARY_FUNCTION(T, cbrt) \
3461 RVEC_EXTERN_STD_BINARY_FUNCTION(T, hypot) \
3462 RVEC_EXTERN_STD_UNARY_FUNCTION(T, sin) \
3463 RVEC_EXTERN_STD_UNARY_FUNCTION(T, cos) \
3464 RVEC_EXTERN_STD_UNARY_FUNCTION(T, tan) \
3465 RVEC_EXTERN_STD_UNARY_FUNCTION(T, asin) \
3466 RVEC_EXTERN_STD_UNARY_FUNCTION(T, acos) \
3467 RVEC_EXTERN_STD_UNARY_FUNCTION(T, atan) \
3468 RVEC_EXTERN_STD_BINARY_FUNCTION(T, atan2) \
3469 RVEC_EXTERN_STD_UNARY_FUNCTION(T, sinh) \
3470 RVEC_EXTERN_STD_UNARY_FUNCTION(T, cosh) \
3471 RVEC_EXTERN_STD_UNARY_FUNCTION(T, tanh) \
3472 RVEC_EXTERN_STD_UNARY_FUNCTION(T, asinh) \
3473 RVEC_EXTERN_STD_UNARY_FUNCTION(T, acosh) \
3474 RVEC_EXTERN_STD_UNARY_FUNCTION(T, atanh) \
3475 RVEC_EXTERN_STD_UNARY_FUNCTION(T, floor) \
3476 RVEC_EXTERN_STD_UNARY_FUNCTION(T, ceil) \
3477 RVEC_EXTERN_STD_UNARY_FUNCTION(T, trunc) \
3478 RVEC_EXTERN_STD_UNARY_FUNCTION(T, round) \
3479 RVEC_EXTERN_STD_UNARY_FUNCTION(T, erf) \
3480 RVEC_EXTERN_STD_UNARY_FUNCTION(T, erfc) \
3481 RVEC_EXTERN_STD_UNARY_FUNCTION(T, lgamma) \
3482 RVEC_EXTERN_STD_UNARY_FUNCTION(T, tgamma) \
3486#undef RVEC_EXTERN_STD_UNARY_FUNCTION
3487#undef RVEC_EXTERN_STD_BINARY_FUNCTION
3488#undef RVEC_EXTERN_STD_UNARY_FUNCTIONS
3492#define RVEC_EXTERN_VDT_UNARY_FUNCTION(T, F) RVEC_EXTERN_UNARY_FUNCTION(T, F, vdt::F)
#define R__unlikely(expr)
#define R__RVEC_NODISCARD
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
#define R__CLING_PTRCHECK(ONOFF)
static Double_t Product(const Double_t *x, const Float_t *y)
Product.
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Double_t Dot(const TGLVector3 &v1, const TGLVector3 &v2)
Int_t Compare(const void *item1, const void *item2)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char y1
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void assign(size_type NumElts, const T &Elt)
typename SuperClass::size_type size_type
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
iterator insert(iterator I, T &&Elt)
void assign(std::initializer_list< T > IL)
void resize(size_type N, const T &NV)
void reserve(size_type N)
iterator insert(iterator I, ItTy From, ItTy To)
reference emplace_back(ArgTypes &&...Args)
void assign(in_iter in_start, in_iter in_end)
iterator insert(iterator I, const T &Elt)
iterator insert(iterator I, size_type NumToInsert, const T &Elt)
RVecImpl & operator=(const RVecImpl &RHS)
iterator erase(const_iterator CS, const_iterator CE)
typename SuperClass::reference reference
void append(size_type NumInputs, const T &Elt)
Append NumInputs copies of Elt to the end.
iterator erase(const_iterator CI)
RVecImpl & operator=(RVecImpl &&RHS)
void pop_back_n(size_type NumItems)
RVecImpl(const RVecImpl &)=delete
void append(std::initializer_list< T > IL)
void insert(iterator I, std::initializer_list< T > IL)
This is all the stuff common to all SmallVectors.
SmallVectorBase(void *FirstEl, size_t TotalCapacity)
static constexpr size_t SizeTypeMax()
The maximum value of the Size_T used.
Size_T fCapacity
Always >= -1. fCapacity == -1 indicates the RVec is in "memory adoption" mode.
bool Owns() const
If false, the RVec is in "memory adoption" mode, i.e. it is acting as a view on a memory buffer it do...
size_t capacity() const noexcept
void set_size(size_t N)
Set the array size to N, which the current array must have enough capacity for.
void grow(size_t MinSize=0)
Double the size of the allocated memory, guaranteeing space for at least one more element or MinSize ...
typename SuperClass::size_type size_type
typename SuperClass::reference reference
void push_back(const T &Elt)
static void uninitialized_move(It1 I, It1 E, It2 Dest)
Move the range [I, E) onto the uninitialized memory starting with "Dest", constructing elements into ...
SmallVectorTemplateBase(size_t Size)
static void uninitialized_copy(T1 *I, T1 *E, T2 *Dest, typename std::enable_if< std::is_same< typename std::remove_const< T1 >::type, T2 >::value >::type *=nullptr)
Copy the range [I, E) onto the uninitialized memory starting with "Dest", constructing elements into ...
static void destroy_range(T *, T *)
static void uninitialized_copy(It1 I, It1 E, It2 Dest)
Copy the range [I, E) onto the uninitialized memory starting with "Dest", constructing elements into ...
SmallVectorTemplateBase<TriviallyCopyable = false> - This is where we put method implementations that...
void push_back(const T &Elt)
void grow(size_t MinSize=0)
Grow the allocated memory (without initializing new elements), doubling the size of the allocated mem...
static void uninitialized_move(It1 I, It1 E, It2 Dest)
Move the range [I, E) into the uninitialized memory starting with "Dest", constructing elements as ne...
SmallVectorTemplateBase(size_t Size)
static void destroy_range(T *S, T *E)
static void uninitialized_copy(It1 I, It1 E, It2 Dest)
Copy the range [I, E) onto the uninitialized memory starting with "Dest", constructing elements as ne...
This is the part of SmallVectorTemplateBase which does not depend on whether the type T is a POD.
size_type max_size() const noexcept
const_iterator cbegin() const noexcept
void grow_pod(size_t MinSize, size_t TSize)
ptrdiff_t difference_type
reverse_iterator rbegin() noexcept
const_iterator cend() const noexcept
const_reference back() const
void resetToSmall()
Put this vector in a state of being small.
iterator begin() noexcept
std::reverse_iterator< iterator > reverse_iterator
const T & const_reference
bool isSmall() const
Return true if this is a smallvector which has not had dynamic memory allocated for it.
const_reverse_iterator crend() const noexcept
const_iterator end() const noexcept
SmallVectorTemplateCommon(size_t Size)
const_reverse_iterator crbegin() const noexcept
pointer data() noexcept
Return a pointer to the vector's buffer, even if empty().
size_t capacity_in_bytes() const
reverse_iterator rend() noexcept
const_reverse_iterator rbegin() const noexcept
const_reference front() const
size_type size_in_bytes() const
std::reverse_iterator< const_iterator > const_reverse_iterator
const_iterator begin() const noexcept
const_pointer data() const noexcept
Return a pointer to the vector's buffer, even if empty().
void * getFirstEl() const
Find the address of the first element.
const_reverse_iterator rend() const noexcept
const_iterator begin() const
const_iterator end() const
RVecN(Detail::VecOps::RVecImpl< T > &&RHS)
reference operator[](size_type idx)
typename Internal::VecOps::SmallVectorTemplateCommon< T >::const_reference const_reference
RVecN operator[](const RVecN< V, M > &conds) const
RVecN(std::initializer_list< T > IL)
const_reference at(size_type pos) const
RVecN & operator=(Detail::VecOps::RVecImpl< T > &&RHS)
RVecN & operator=(RVecN &&RHS)
typename Internal::VecOps::SmallVectorTemplateCommon< T >::size_type size_type
value_type at(size_type pos, value_type fallback) const
No exception thrown. The user specifies the desired value in case the RVecN is shorter than pos.
RVecN & operator=(std::initializer_list< T > IL)
RVecN & operator=(const RVecN &RHS)
RVecN(const std::vector< T > &RHS)
RVecN(size_t Size, const T &Value)
reference at(size_type pos)
value_type at(size_type pos, value_type fallback)
No exception thrown. The user specifies the desired value in case the RVecN is shorter than pos.
typename Internal::VecOps::SmallVectorTemplateCommon< T >::reference reference
typename Internal::VecOps::SmallVectorTemplateCommon< T >::value_type value_type
const_reference operator[](size_type idx) const
A "std::vector"-like collection of values implementing handy operation to analyse them.
RVec(RVecN< T, N > &&RHS)
typename SuperClass::reference reference
RVec(const RVecN< T, N > &RHS)
RVec(size_t Size, const T &Value)
RVec & operator=(RVec &&RHS)
RVec operator[](const RVec< V > &conds) const
RVec(std::initializer_list< T > IL)
typename SuperClass::const_reference const_reference
RVec(const std::vector< T > &RHS)
typename SuperClass::size_type size_type
RVec(Detail::VecOps::RVecImpl< T > &&RHS)
typename SuperClass::value_type value_type
RVec & operator=(const RVec &RHS)
RVec< T > Reverse(const RVec< T > &v)
Return copy of reversed vector.
RVec< T > Intersect(const RVec< T > &v1, const RVec< T > &v2, bool v2_is_sorted=false)
Return the intersection of elements of two RVecs.
RVec< typename RVec< T >::size_type > Nonzero(const RVec< T > &v)
Return the indices of the elements which are not zero.
#define RVEC_UNARY_OPERATOR(OP)
#define RVEC_ASSIGNMENT_OPERATOR(OP)
RVec< typename RVec< T >::size_type > StableArgsort(const RVec< T > &v)
Return an RVec of indices that sort the input RVec while keeping the order of equal elements.
RVec< Common_t > Concatenate(const RVec< T0 > &v0, const RVec< T1 > &v1)
Return the concatenation of two RVecs.
Common_t InvariantMasses_PxPyPzM(const T0 &x1, const T1 &y1, const T2 &z1, const T3 &mass1, const T4 &x2, const T5 &y2, const T6 &z2, const T7 &mass2)
Return the invariant mass of two particles given x coordinate (px), y coordinate (py),...
T Sum(const RVec< T > &v, const T zero=T(0))
Sum elements of an RVec.
RVec< Common_t > InvariantMasses(const RVec< T0 > &pt1, const RVec< T1 > &eta1, const RVec< T2 > &phi1, const RVec< T3 > &mass1, const RVec< T4 > &pt2, const RVec< T5 > &eta2, const RVec< T6 > &phi2, const RVec< T7 > &mass2)
Return the invariant mass of two particles given the collections of the quantities transverse momentu...
RVec< T > Take(const RVec< T > &v, const RVec< typename RVec< T >::size_type > &i)
Return elements of a vector at given indices.
void swap(RVec< T > &lhs, RVec< T > &rhs)
RVec< T > Construct(const RVec< Args_t > &... args)
Build an RVec of objects starting from RVecs of input to their constructors.
#define RVEC_STD_BINARY_FUNCTION(F)
#define RVEC_BINARY_OPERATOR(OP)
RVec< T > Drop(const RVec< T > &v, RVec< typename RVec< T >::size_type > idxs)
Return a copy of the container without the elements at the specified indices.
size_t CapacityInBytes(const RVecN< T, N > &X)
#define RVEC_LOGICAL_OPERATOR(OP)
RVec< RVec< std::size_t > > Combinations(const std::size_t size1, const std::size_t size2)
Return the indices that represent all combinations of the elements of two RVecs.
#define RVEC_STD_UNARY_FUNCTION(F)
RVec< typename RVec< T >::size_type > Enumerate(const RVec< T > &v)
For any Rvec v produce another RVec with entries starting from 0, and incrementing by 1 until a N = v...
auto Map(Args &&... args)
Create new collection applying a callable to the elements of the input collection.
RVec< T > Where(const RVec< int > &c, const RVec< T > &v1, const RVec< T > &v2)
Return the elements of v1 if the condition c is true and v2 if the condition c is false.
auto Any(const RVec< T > &v) -> decltype(v[0]==true)
Return true if any of the elements equates to true, return false otherwise.
RVec< typename RVec< T >::size_type > Argsort(const RVec< T > &v)
Return an RVec of indices that sort the input RVec.
std::size_t ArgMin(const RVec< T > &v)
Get the index of the smallest element of an RVec In case of multiple occurrences of the minimum value...
RVec< T > StableSort(const RVec< T > &v)
Return copy of RVec with elements sorted in ascending order while keeping the order of equal elements...
RVec< T > Filter(const RVec< T > &v, F &&f)
Create a new collection with the elements passing the filter expressed by the predicate.
std::size_t ArgMax(const RVec< T > &v)
Get the index of the greatest element of an RVec In case of multiple occurrences of the maximum value...
bool IsSmall(const ROOT::VecOps::RVec< T > &v)
bool IsAdopting(const ROOT::VecOps::RVec< T > &v)
auto MapImpl(F &&f, RVecs &&... vs) -> RVec< decltype(f(vs[0]...))>
void ResetView(RVec< T > &v, T *addr, std::size_t sz)
An unsafe function to reset the buffer for which this RVec is acting as a view.
uint64_t NextPowerOf2(uint64_t A)
Return the next power of two (in 64-bits) that is strictly greater than A.
constexpr bool All(const bool *vals, std::size_t size)
std::size_t GetVectorsSize(const std::string &id, const RVec< T > &... vs)
void UninitializedValueConstruct(ForwardIt first, ForwardIt last)
auto MapFromTuple(Tuple_t &&t, std::index_sequence< Is... >) -> decltype(MapImpl(std::get< std::tuple_size< Tuple_t >::value - 1 >(t), std::get< Is >(t)...))
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
The size of the inline storage of an RVec.
Used to figure out the offset of the first element of an RVec.
Storage for the SmallVector elements.