CMS 3D CMS Logo

RKSmallVector.h File Reference

#include "DataFormats/GeometryVector/interface/PreciseFloatType.h"
#include <iostream>

Go to the source code of this file.

Classes

class  RKSmallVector< T, N >

Functions

template<class T, class Scal, int N>
RKSmallVector< T, N > operator * (const Scal &s, const RKSmallVector< T, N > &v)
template<class T, class Scal, int N>
RKSmallVector< T, N > operator * (const RKSmallVector< T, N > &v, const Scal &s)
 Multiplication by scalar, does not change the precision of the vector.
template<class T, class U, int N>
RKSmallVector< typename
PreciseFloatType< T, U >::Type,
N > 
operator+ (const RKSmallVector< T, N > &a, const RKSmallVector< U, N > &b)
 vector sum and subtraction of vectors of possibly different precision
template<class T, class U, int N>
RKSmallVector< typename
PreciseFloatType< T, U >::Type,
N > 
operator- (const RKSmallVector< T, N > &a, const RKSmallVector< U, N > &b)
template<class T, class Scal, int N>
RKSmallVector< T, N > operator/ (const RKSmallVector< T, N > &v, const Scal &s)
 Division by scalar, does not change the precision of the vector.
template<class T, int N>
std::ostream & operator<< (std::ostream &s, const RKSmallVector< T, N > &v)
 simple text output to standard streams


Function Documentation

template<class T, class Scal, int N>
RKSmallVector<T,N> operator * ( const Scal &  s,
const RKSmallVector< T, N > &  v 
) [inline]

Definition at line 125 of file RKSmallVector.h.

References i, N, r, and t.

00125                                                                                  {
00126   T t = static_cast<T>(s);
00127   RKSmallVector<T,N> r;
00128   for (int i=0; i<N; ++i) r[i] = t*v[i];
00129   return r;
00130 }

template<class T, class Scal, int N>
RKSmallVector<T,N> operator * ( const RKSmallVector< T, N > &  v,
const Scal &  s 
) [inline]

Multiplication by scalar, does not change the precision of the vector.

The return type is the same as the type of the vector argument.

Definition at line 118 of file RKSmallVector.h.

References i, N, r, and t.

00118                                                                                  {
00119   T t = static_cast<T>(s);
00120   RKSmallVector<T,N> r;
00121   for (int i=0; i<N; ++i) r[i] = t*v[i];
00122   return r;
00123 }

template<class T, class U, int N>
RKSmallVector<typename PreciseFloatType<T,U>::Type, N> operator+ ( const RKSmallVector< T, N > &  a,
const RKSmallVector< U, N > &  b 
) [inline]

vector sum and subtraction of vectors of possibly different precision

Definition at line 99 of file RKSmallVector.h.

References i, N, and r.

00099                                                                        {
00100   typedef RKSmallVector<typename PreciseFloatType<T,U>::Type, N> RT;
00101   RT r;
00102   for (int i=0; i<N; ++i) r[i] = a[i]+b[i];
00103   return r;
00104 }

template<class T, class U, int N>
RKSmallVector<typename PreciseFloatType<T,U>::Type, N> operator- ( const RKSmallVector< T, N > &  a,
const RKSmallVector< U, N > &  b 
) [inline]

Definition at line 107 of file RKSmallVector.h.

References i, N, and r.

00107                                                                        {
00108   typedef RKSmallVector<typename PreciseFloatType<T,U>::Type, N> RT;
00109   RT r;
00110   for (int i=0; i<N; ++i) r[i] = a[i]-b[i];
00111   return r;
00112 }

template<class T, class Scal, int N>
RKSmallVector<T,N> operator/ ( const RKSmallVector< T, N > &  v,
const Scal &  s 
) [inline]

Division by scalar, does not change the precision of the vector.

The return type is the same as the type of the vector argument.

Definition at line 136 of file RKSmallVector.h.

References i, N, r, and t.

00136                                                                                  {
00137   T t = static_cast<T>(s);
00138   RKSmallVector<T,N> r;
00139   for (int i=0; i<N; ++i) r[i] = v[i]/t;
00140   return r;
00141 }

template<class T, int N>
std::ostream& operator<< ( std::ostream &  s,
const RKSmallVector< T, N > &  v 
) [inline]

simple text output to standard streams

Definition at line 90 of file RKSmallVector.h.

References lat::endl(), i, N, s, and v.

00090                                                                             {
00091   s << std::endl;
00092   for (int i=0; i<N; ++i) s << "v[" << i << "] = " << v[i] << std::endl;
00093   return s;
00094 } 


Generated on Tue Jun 9 17:56:01 2009 for CMSSW by  doxygen 1.5.4