4#ifndef ROOT_Math_SVector_icc
5#define ROOT_Math_SVector_icc
34#ifndef ROOT_Math_SVector
35#error "Do not use SVector.icc directly. #include \"Math/SVector.h\" instead."
52template <
class T,
unsigned int D>
54 for(
unsigned int i=0; i<D; ++i)
58template <
class T,
unsigned int D>
64template <
class T,
unsigned int D>
66 for(
unsigned int i=0; i<D; ++i)
77template <
class T,
unsigned int D>
78template <
class InputIterator>
80 assert(begin + D == end);
81 std::copy(begin, end, fArray);
84template <
class T,
unsigned int D>
85template <
class InputIterator>
88 std::copy(begin, begin+
size, fArray);
93template <
class T,
unsigned int D>
97 for(
unsigned int i=0; i<D; ++i)
101template <
class T,
unsigned int D>
103 assert(ibegin + D == iend);
104 std::copy(ibegin, iend, fArray);
111template <
class T,
unsigned int D>
117template <
class T,
unsigned int D>
120 fArray[0] = a1; fArray[1] = a2;
123template <
class T,
unsigned int D>
126 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3;
129template <
class T,
unsigned int D>
132 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
135template <
class T,
unsigned int D>
139 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
143template <
class T,
unsigned int D>
145 const T& a5,
const T& a6) {
147 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
148 fArray[4] = a5; fArray[5] = a6;
151template <
class T,
unsigned int D>
153 const T& a5,
const T& a6,
const T& a7) {
155 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
156 fArray[4] = a5; fArray[5] = a6; fArray[6] = a7;
159template <
class T,
unsigned int D>
161 const T& a5,
const T& a6,
const T& a7,
const T& a8) {
163 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
164 fArray[4] = a5; fArray[5] = a6; fArray[6] = a7; fArray[7] = a8;
167template <
class T,
unsigned int D>
169 const T& a5,
const T& a6,
const T& a7,
const T& a8,
172 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
173 fArray[4] = a5; fArray[5] = a6; fArray[6] = a7; fArray[7] = a8;
177template <
class T,
unsigned int D>
179 const T& a5,
const T& a6,
const T& a7,
const T& a8,
180 const T& a9,
const T& a10) {
182 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
183 fArray[4] = a5; fArray[5] = a6; fArray[6] = a7; fArray[7] = a8;
184 fArray[8] = a9; fArray[9] = a10;
190template <
class T,
unsigned int D>
198template <
class T,
unsigned int D>
200 for(
unsigned int i=0; i<D; ++i)
201 fArray[i] = rhs.
fArray[i];
205template <
class T,
unsigned int D>
209 for(
unsigned int i=0; i<D; ++i) {
210 fArray[i] = rhs.
apply(i);
216 for(
unsigned int i=0; i<D; ++i) {
217 tmp[i] = rhs.
apply(i);
219 for(
unsigned int i=0; i<D; ++i) {
229template <
class T,
unsigned int D>
232 for(
unsigned int i=0; i<D; ++i) {
233 rc = rc && (fArray[i] == rhs);
238template <
class T,
unsigned int D>
241 for(
unsigned int i=0; i<D; ++i) {
242 rc = rc && (fArray[i] == rhs.
apply(i));
247template <
class T,
unsigned int D>
251 for(
unsigned int i=0; i<D; ++i) {
252 rc = rc && (fArray[i] == rhs.
apply(i));
260template <
class T,
unsigned int D>
265template <
class T,
unsigned int D>
270template <
class T,
unsigned int D>
279template <
class T,
unsigned int D>
282 for(
unsigned int i=0; i<D; ++i) {
283 rc = rc && (fArray[i] > rhs);
288template <
class T,
unsigned int D>
291 for(
unsigned int i=0; i<D; ++i) {
292 rc = rc && (fArray[i] > rhs.
apply(i));
297template <
class T,
unsigned int D>
301 for(
unsigned int i=0; i<D; ++i) {
302 rc = rc && (fArray[i] > rhs.
apply(i));
310template <
class T,
unsigned int D>
313 for(
unsigned int i=0; i<D; ++i) {
314 rc = rc && (fArray[i] < rhs);
319template <
class T,
unsigned int D>
322 for(
unsigned int i=0; i<D; ++i) {
323 rc = rc && (fArray[i] < rhs.
apply(i));
328template <
class T,
unsigned int D>
332 for(
unsigned int i=0; i<D; ++i) {
333 rc = rc && (fArray[i] < rhs.
apply(i));
342template <
class T,
unsigned int D>
348template <
class T,
unsigned int D>
355template <
class T,
unsigned int D>
362template <
class T,
unsigned int D>
370template <
class T,
unsigned int D>
372 for(
unsigned int i=0; i<D; ++i) {
378template <
class T,
unsigned int D>
380 for(
unsigned int i=0; i<D; ++i) {
381 fArray[i] += rhs.
apply(i);
387template <
class T,
unsigned int D>
390 for(
unsigned int i=0; i<D; ++i) {
391 fArray[i] += rhs.
apply(i);
399template <
class T,
unsigned int D>
401 for(
unsigned int i=0; i<D; ++i) {
407template <
class T,
unsigned int D>
409 for(
unsigned int i=0; i<D; ++i) {
410 fArray[i] -= rhs.
apply(i);
415template <
class T,
unsigned int D>
418 for(
unsigned int i=0; i<D; ++i) {
419 fArray[i] -= rhs.
apply(i);
427template <
class T,
unsigned int D>
429 for(
unsigned int i=0; i<D; ++i) {
435template <
class T,
unsigned int D>
438 for(
unsigned int i=0; i<D; ++i) {
439 fArray[i] *= rhs.
apply(i);
447template <
class T,
unsigned int D>
449 for(
unsigned int i=0; i<D; ++i) {
450 fArray[i] /= rhs.apply(i);
455template <
class T,
unsigned int D>
458 for(
unsigned int i=0; i<D; ++i) {
459 fArray[i] /= rhs.apply(i);
464template <
class T,
unsigned int D>
466 for(
unsigned int i=0; i<D; ++i) {
476template <
class T,
unsigned int D>
478 const T len =
Mag(*
this);
479 for(
unsigned int i=0; i<D; ++i) {
488template <
class T,
unsigned int D>
489template <
unsigned int D2>
495 for(
unsigned int i=row, j=0; j<D2; ++i,++j)
496 fArray[i] = rhs.
apply(j);
505template <
class T,
unsigned int D>
506template <
class A,
unsigned int D2>
511 for(
unsigned int i=row, j=0; j<D2; ++i,++j)
512 fArray[i] = rhs.
apply(j);
520template <
class T,
unsigned int D>
522 const std::ios_base::fmtflags prevFmt = os.setf(std::ios::right,std::ios::adjustfield);
525 for (
unsigned int i = 0; i < D; ++i ) {
527 if (i != D-1) os <<
", ";
529 if (prevFmt != os.flags() ) os.setf(prevFmt, std::ios::adjustfield);
536template <
class T,
unsigned int D>
539template <
class T,
unsigned int D>
542template <
class T,
unsigned int D>
549template <
class T,
unsigned int D>
552template <
class T,
unsigned int D>
555template <
class T,
unsigned int D>
558template <
class T,
unsigned int D>
561template <
class T,
unsigned int D>
562template <
class InputIterator>
565 assert( ibegin + D == iend);
566 std::copy(ibegin, iend, fArray);
569template <
class T,
unsigned int D>
570template <
class InputIterator>
574 std::copy(ibegin, ibegin+
size, fArray);
581template <
class T,
unsigned int D>
584template <
class T,
unsigned int D>
587template <
class T,
unsigned int D>
590template <
class T,
unsigned int D>
595template <
class T,
unsigned int D>
601template <
class T,
unsigned int D>
610template <
class T,
unsigned int D>
611template <
class SubVector>
614 STATIC_CHECK( SubVector::kSize <= D,SVector_dimension_too_small);
616 assert(row + SubVector::kSize <= D);
620 for(
unsigned int i=0; i < SubVector::kSize; ++i) {
621 tmp[i] = fArray[i+row];
627template <
class T,
unsigned int D>
636template <
class T,
unsigned int D>
638 return rhs.
Print(os);
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
#define STATIC_CHECK(expr, msg)
Binding & operator=(OUT(*fun)(void))
SVector: a generic fixed size Vector class.
const T * const_iterator
STL const_iterator interface.
SVector< T, D > & operator=(const T &a1)
assignment from a scalar (only for size 1 vector)
bool operator>(const T &rhs) const
element wise comparison
SVector< T, D > & Place_at(const SVector< T, D2 > &rhs, unsigned int row)
place a sub-vector starting from the given position
iterator begin()
STL iterator interface.
SVector< T, D > & operator*=(const T &rhs)
self multiplication with a scalar
SVector< T, D > & Unit()
transform vector into a vector of length 1
SubVector Sub(unsigned int row) const
return a subvector of size N starting at the value row where N is the size of the returned vector (Su...
const T * Array() const
return read-only pointer to internal array
T apply(unsigned int i) const
access the parse tree. Index starts from zero
const T & At(unsigned int i) const
read-only access of vector elements with check on index. Index starts from 0.
bool operator!=(const T &rhs) const
element wise comparison
SVector()
Default constructor: vector filled with zero values.
const T & operator()(unsigned int i) const
read-only access of vector elements. Index starts from 0.
SVector< T, D > & operator-=(const T &rhs)
self subtraction with a scalar
bool IsInUse(const T *p) const
Function to check if a vector is sharing same memory location of the passed pointer This function is ...
bool operator<(const T &rhs) const
element wise comparison
const T & operator[](unsigned int i) const
read-only access of vector elements. Index starts from 0.
SVector< T, D > & operator+=(const T &rhs)
self addition with a scalar
bool operator==(const T &rhs) const
element wise comparison
SVector< T, D > & operator/=(const T &rhs)
self division with a scalar
std::ostream & Print(std::ostream &os) const
used by operator<<()
iterator end()
STL iterator interface.
void SetElements(InputIterator begin, InputIterator end)
set vector elements copying the values iterator size must match vector size
Expression wrapper class for Vector objects.
T apply(unsigned int i) const
bool IsInUse(const T *p) const
function to determine if any use operand is being used (has same memory adress)
T Mag(const SVector< T, D > &rhs)
Vector magnitude (Euclidian norm) Compute : .
Namespace for new Math classes and functions.
bool operator==(const RConcurrentHashColl::HashValue &lhs, const RConcurrentHashColl::HashValue &rhs)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...