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>
203 for(
unsigned int i=0; i<D; ++i)
204 fArray[i] = rhs.
fArray[i];
208template <
class T,
unsigned int D>
212 for(
unsigned int i=0; i<D; ++i) {
213 fArray[i] = rhs.
apply(i);
219 for(
unsigned int i=0; i<D; ++i) {
220 tmp[i] = rhs.
apply(i);
222 for(
unsigned int i=0; i<D; ++i) {
232template <
class T,
unsigned int D>
235 for(
unsigned int i=0; i<D; ++i) {
236 rc = rc && (fArray[i] == rhs);
241template <
class T,
unsigned int D>
244 for(
unsigned int i=0; i<D; ++i) {
245 rc = rc && (fArray[i] == rhs.
apply(i));
250template <
class T,
unsigned int D>
254 for(
unsigned int i=0; i<D; ++i) {
255 rc = rc && (fArray[i] == rhs.
apply(i));
263template <
class T,
unsigned int D>
268template <
class T,
unsigned int D>
273template <
class T,
unsigned int D>
282template <
class T,
unsigned int D>
285 for(
unsigned int i=0; i<D; ++i) {
286 rc = rc && (fArray[i] > rhs);
291template <
class T,
unsigned int D>
294 for(
unsigned int i=0; i<D; ++i) {
295 rc = rc && (fArray[i] > rhs.
apply(i));
300template <
class T,
unsigned int D>
304 for(
unsigned int i=0; i<D; ++i) {
305 rc = rc && (fArray[i] > rhs.
apply(i));
313template <
class T,
unsigned int D>
316 for(
unsigned int i=0; i<D; ++i) {
317 rc = rc && (fArray[i] < rhs);
322template <
class T,
unsigned int D>
325 for(
unsigned int i=0; i<D; ++i) {
326 rc = rc && (fArray[i] < rhs.
apply(i));
331template <
class T,
unsigned int D>
335 for(
unsigned int i=0; i<D; ++i) {
336 rc = rc && (fArray[i] < rhs.
apply(i));
345template <
class T,
unsigned int D>
351template <
class T,
unsigned int D>
358template <
class T,
unsigned int D>
365template <
class T,
unsigned int D>
373template <
class T,
unsigned int D>
375 for(
unsigned int i=0; i<D; ++i) {
381template <
class T,
unsigned int D>
383 for(
unsigned int i=0; i<D; ++i) {
384 fArray[i] += rhs.
apply(i);
390template <
class T,
unsigned int D>
393 for(
unsigned int i=0; i<D; ++i) {
394 fArray[i] += rhs.
apply(i);
402template <
class T,
unsigned int D>
404 for(
unsigned int i=0; i<D; ++i) {
410template <
class T,
unsigned int D>
412 for(
unsigned int i=0; i<D; ++i) {
413 fArray[i] -= rhs.
apply(i);
418template <
class T,
unsigned int D>
421 for(
unsigned int i=0; i<D; ++i) {
422 fArray[i] -= rhs.
apply(i);
430template <
class T,
unsigned int D>
432 for(
unsigned int i=0; i<D; ++i) {
438template <
class T,
unsigned int D>
441 for(
unsigned int i=0; i<D; ++i) {
442 fArray[i] *= rhs.
apply(i);
450template <
class T,
unsigned int D>
452 for(
unsigned int i=0; i<D; ++i) {
453 fArray[i] /= rhs.apply(i);
458template <
class T,
unsigned int D>
461 for(
unsigned int i=0; i<D; ++i) {
462 fArray[i] /= rhs.apply(i);
467template <
class T,
unsigned int D>
469 for(
unsigned int i=0; i<D; ++i) {
479template <
class T,
unsigned int D>
481 const T len =
Mag(*
this);
482 for(
unsigned int i=0; i<D; ++i) {
491template <
class T,
unsigned int D>
492template <
unsigned int D2>
498 for(
unsigned int i=row, j=0; j<D2; ++i,++j)
499 fArray[i] = rhs.
apply(j);
508template <
class T,
unsigned int D>
509template <
class A,
unsigned int D2>
514 for(
unsigned int i=row, j=0; j<D2; ++i,++j)
515 fArray[i] = rhs.
apply(j);
523template <
class T,
unsigned int D>
525 const std::ios_base::fmtflags prevFmt = os.setf(std::ios::right,std::ios::adjustfield);
528 for (
unsigned int i = 0; i < D; ++i ) {
530 if (i != D-1) os <<
", ";
532 if (prevFmt != os.flags() ) os.setf(prevFmt, std::ios::adjustfield);
539template <
class T,
unsigned int D>
542template <
class T,
unsigned int D>
545template <
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>
564template <
class T,
unsigned int D>
565template <
class InputIterator>
568 assert( ibegin + D == iend);
569 std::copy(ibegin, iend, fArray);
572template <
class T,
unsigned int D>
573template <
class InputIterator>
577 std::copy(ibegin, ibegin+size, fArray);
584template <
class T,
unsigned int D>
587template <
class T,
unsigned int D>
590template <
class T,
unsigned int D>
593template <
class T,
unsigned int D>
598template <
class T,
unsigned int D>
604template <
class T,
unsigned int D>
613template <
class T,
unsigned int D>
614template <
class SubVector>
624 tmp[i] = fArray[i+row];
630template <
class T,
unsigned int D>
639template <
class T,
unsigned int D>
641 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.