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>
100 for(
unsigned int i=0; i<D; ++i)
104template <
class T,
unsigned int D>
106 assert(ibegin + D == iend);
107 std::copy(ibegin, iend, fArray);
114template <
class T,
unsigned int D>
120template <
class T,
unsigned int D>
123 fArray[0] = a1; fArray[1] = a2;
126template <
class T,
unsigned int D>
129 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3;
132template <
class T,
unsigned int D>
135 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
138template <
class T,
unsigned int D>
142 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
146template <
class T,
unsigned int D>
148 const T& a5,
const T& a6) {
150 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
151 fArray[4] = a5; fArray[5] = a6;
154template <
class T,
unsigned int D>
156 const T& a5,
const T& a6,
const T& a7) {
158 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
159 fArray[4] = a5; fArray[5] = a6; fArray[6] = a7;
162template <
class T,
unsigned int D>
164 const T& a5,
const T& a6,
const T& a7,
const T& a8) {
166 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
167 fArray[4] = a5; fArray[5] = a6; fArray[6] = a7; fArray[7] = a8;
170template <
class T,
unsigned int D>
172 const T& a5,
const T& a6,
const T& a7,
const T& a8,
175 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
176 fArray[4] = a5; fArray[5] = a6; fArray[6] = a7; fArray[7] = a8;
180template <
class T,
unsigned int D>
182 const T& a5,
const T& a6,
const T& a7,
const T& a8,
183 const T& a9,
const T& a10) {
185 fArray[0] = a1; fArray[1] = a2; fArray[2] = a3; fArray[3] = a4;
186 fArray[4] = a5; fArray[5] = a6; fArray[6] = a7; fArray[7] = a8;
187 fArray[8] = a9; fArray[9] = a10;
193template <
class T,
unsigned int D>
201template <
class T,
unsigned int D>
205 for(
unsigned int i=0; i<D; ++i) {
206 fArray[i] = rhs.
apply(i);
212 for(
unsigned int i=0; i<D; ++i) {
213 tmp[i] = rhs.
apply(i);
215 for(
unsigned int i=0; i<D; ++i) {
225template <
class T,
unsigned int D>
228 for(
unsigned int i=0; i<D; ++i) {
229 rc = rc && (fArray[i] == rhs);
234template <
class T,
unsigned int D>
237 for(
unsigned int i=0; i<D; ++i) {
238 rc = rc && (fArray[i] == rhs.
apply(i));
243template <
class T,
unsigned int D>
247 for(
unsigned int i=0; i<D; ++i) {
248 rc = rc && (fArray[i] == rhs.
apply(i));
256template <
class T,
unsigned int D>
261template <
class T,
unsigned int D>
266template <
class T,
unsigned int D>
275template <
class T,
unsigned int D>
278 for(
unsigned int i=0; i<D; ++i) {
279 rc = rc && (fArray[i] > rhs);
284template <
class T,
unsigned int D>
287 for(
unsigned int i=0; i<D; ++i) {
288 rc = rc && (fArray[i] > rhs.
apply(i));
293template <
class T,
unsigned int D>
297 for(
unsigned int i=0; i<D; ++i) {
298 rc = rc && (fArray[i] > rhs.
apply(i));
306template <
class T,
unsigned int D>
309 for(
unsigned int i=0; i<D; ++i) {
310 rc = rc && (fArray[i] < rhs);
315template <
class T,
unsigned int D>
318 for(
unsigned int i=0; i<D; ++i) {
319 rc = rc && (fArray[i] < rhs.
apply(i));
324template <
class T,
unsigned int D>
328 for(
unsigned int i=0; i<D; ++i) {
329 rc = rc && (fArray[i] < rhs.
apply(i));
338template <
class T,
unsigned int D>
344template <
class T,
unsigned int D>
351template <
class T,
unsigned int D>
358template <
class T,
unsigned int D>
366template <
class T,
unsigned int D>
368 for(
unsigned int i=0; i<D; ++i) {
374template <
class T,
unsigned int D>
376 for(
unsigned int i=0; i<D; ++i) {
377 fArray[i] += rhs.
apply(i);
383template <
class T,
unsigned int D>
386 for(
unsigned int i=0; i<D; ++i) {
387 fArray[i] += rhs.
apply(i);
395template <
class T,
unsigned int D>
397 for(
unsigned int i=0; i<D; ++i) {
403template <
class T,
unsigned int D>
405 for(
unsigned int i=0; i<D; ++i) {
406 fArray[i] -= rhs.
apply(i);
411template <
class T,
unsigned int D>
414 for(
unsigned int i=0; i<D; ++i) {
415 fArray[i] -= rhs.
apply(i);
423template <
class T,
unsigned int D>
425 for(
unsigned int i=0; i<D; ++i) {
431template <
class T,
unsigned int D>
434 for(
unsigned int i=0; i<D; ++i) {
435 fArray[i] *= rhs.
apply(i);
443template <
class T,
unsigned int D>
445 for(
unsigned int i=0; i<D; ++i) {
446 fArray[i] /= rhs.apply(i);
451template <
class T,
unsigned int D>
454 for(
unsigned int i=0; i<D; ++i) {
455 fArray[i] /= rhs.apply(i);
460template <
class T,
unsigned int D>
462 for(
unsigned int i=0; i<D; ++i) {
472template <
class T,
unsigned int D>
474 const T len =
Mag(*
this);
475 for(
unsigned int i=0; i<D; ++i) {
484template <
class T,
unsigned int D>
485template <
unsigned int D2>
491 for(
unsigned int i=row, j=0; j<D2; ++i,++j)
492 fArray[i] = rhs.
apply(j);
501template <
class T,
unsigned int D>
502template <
class A,
unsigned int D2>
507 for(
unsigned int i=row, j=0; j<D2; ++i,++j)
508 fArray[i] = rhs.
apply(j);
516template <
class T,
unsigned int D>
518 const std::ios_base::fmtflags prevFmt = os.setf(std::ios::right,std::ios::adjustfield);
521 for (
unsigned int i = 0; i < D; ++i ) {
523 if (i != D-1) os <<
", ";
525 if (prevFmt != os.flags() ) os.setf(prevFmt, std::ios::adjustfield);
532template <
class T,
unsigned int D>
535template <
class T,
unsigned int D>
538template <
class T,
unsigned int D>
545template <
class T,
unsigned int D>
548template <
class T,
unsigned int D>
551template <
class T,
unsigned int D>
554template <
class T,
unsigned int D>
557template <
class T,
unsigned int D>
558template <
class InputIterator>
561 assert( ibegin + D == iend);
562 std::copy(ibegin, iend, fArray);
565template <
class T,
unsigned int D>
566template <
class InputIterator>
570 std::copy(ibegin, ibegin+size, fArray);
577template <
class T,
unsigned int D>
580template <
class T,
unsigned int D>
583template <
class T,
unsigned int D>
586template <
class T,
unsigned int D>
591template <
class T,
unsigned int D>
597template <
class T,
unsigned int D>
606template <
class T,
unsigned int D>
607template <
class SubVector>
617 tmp[i] = fArray[i+row];
623template <
class T,
unsigned int D>
632template <
class T,
unsigned int D>
634 return rhs.
Print(os);
#define STATIC_CHECK(expr, msg)
Bool_t operator==(const TDatime &d1, const TDatime &d2)
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.
std::ostream & operator<<(std::ostream &os, const AxisAngle &a)
Stream Output and Input.
Namespace for new ROOT classes and functions.