Structural deformable models
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
VVector< T, D > Class Template Reference

#include <VVector.h>

Collaboration diagram for VVector< T, D >:
Collaboration graph
[legend]

Public Types

typedef VVector< T, D > VT
 
typedef T * TPtr
 
typedef const T * CTPtr
 
typedef Traits< T > TTrait
 

Public Member Functions

 VVector ()
 
 VVector (const T &sval)
 
 VVector (CTPtr pval)
 
 VVector (const VT &rhs)
 
 ~VVector ()
 
TPtr begin ()
 
CTPtr begin () const
 
TPtr end ()
 
CTPtr end () const
 
const T & operator[] (unsigned int i) const
 
T & operator[] (unsigned int i)
 
bool operator== (const VT &rhs) const
 
bool operator< (const VT &rhs) const
 
bool operator> (const VT &rhs) const
 
bool operator<= (const VT &rhs) const
 
bool operator>= (const VT &rhs) const
 
VToperator= (const T &rhs)
 
VToperator= (CTPtr rhs)
 
VToperator= (const VT &rhs)
 
VToperator+= (const VT &rhs)
 
VToperator-= (const VT &rhs)
 
VToperator*= (const VT &rhs)
 
VToperator/= (const VT &rhs)
 
VToperator+= (const T &rhs)
 
VToperator-= (const T &rhs)
 
VToperator*= (const T &rhs)
 
VToperator/= (const T &rhs)
 
VT operator+ (const VT &rhs) const
 
VT operator- (const VT &rhs) const
 
VT operator* (const VT &rhs) const
 
VT operator/ (const VT &rhs) const
 
VT operator+ (const T &rhs) const
 
VT operator- (const T &rhs) const
 
VT operator* (const T &rhs) const
 
VT operator/ (const T &rhs) const
 
VTtimes (const VT &rhs)
 
dot (const VT &rhs) const
 
VVector< T, 3 > cross (const VVector< T, 3 > &rhs) const
 
sum () const
 
prod () const
 
norm2 () const
 
norm () const
 
normalize ()
 
avg () const
 
var () const
 
stdev () const
 
VTsqrtEach ()
 
maxVal () const
 
minVal () const
 
unsigned int majorComponent () const
 
VTclampLB (const VT &lb)
 
VTclampUB (const VT &ub)
 
VTclamp (const VT &lb, const VT &ub)
 
float angle (const VT &rhs) const
 

Static Public Member Functions

static VT zero ()
 
static VT one ()
 
static unsigned int size ()
 

Public Attributes

val [D]
 

Friends

std::ostream & operator<< (std::ostream &os, const VT &rhs)
 
std::istream & operator>> (std::istream &is, VT &rhs)
 

Detailed Description

template<class T, unsigned int D>
class VVector< T, D >

a small numerical vector class

Definition at line 14 of file VVector.h.

Member Typedef Documentation

template<class T, unsigned int D>
typedef const T* VVector< T, D >::CTPtr

Definition at line 19 of file VVector.h.

template<class T, unsigned int D>
typedef T* VVector< T, D >::TPtr

Definition at line 18 of file VVector.h.

template<class T, unsigned int D>
typedef Traits<T> VVector< T, D >::TTrait

Definition at line 20 of file VVector.h.

template<class T, unsigned int D>
typedef VVector<T, D> VVector< T, D >::VT

Definition at line 17 of file VVector.h.

Constructor & Destructor Documentation

template<class T, unsigned int D>
VVector< T, D >::VVector ( )
inline

Definition at line 22 of file VVector.h.

22 {};
template<class T, unsigned int D>
VVector< T, D >::VVector ( const T &  sval)
inline

Definition at line 23 of file VVector.h.

23  {
24  operator=(sval);
25  }
VT & operator=(const T &rhs)
Definition: VVector.h:76
template<class T, unsigned int D>
VVector< T, D >::VVector ( CTPtr  pval)
inline

Definition at line 26 of file VVector.h.

26  {
27  operator=(pval);
28  }
VT & operator=(const T &rhs)
Definition: VVector.h:76
template<class T, unsigned int D>
VVector< T, D >::VVector ( const VT rhs)
inline

Definition at line 29 of file VVector.h.

29  {
30  operator=(rhs);
31  }
VT & operator=(const T &rhs)
Definition: VVector.h:76
template<class T, unsigned int D>
VVector< T, D >::~VVector ( )
inline

Definition at line 32 of file VVector.h.

32 {};

Member Function Documentation

template<class T, unsigned int D>
float VVector< T, D >::angle ( const VT rhs) const
inline

Definition at line 262 of file VVector.h.

262  {
263  float dv = cross(rhs).norm(); //sin(a)
264  float dh = dot(rhs); //cos(a)
265 #ifndef _THERE_IS_NO_ATAN2_
266  return atan2(dv,dh);
267 #else
268  float dvp,dvn;
269  if(dv > 0.0) {
270  dvp = 1.0;
271  dvn = 0.0;
272  } else {
273  dvp = 0.0;
274  dvn = 1.0;
275  }
276  float dhn = (dh < 0) ? 1.0 : 0.0;
277  float psi;
278  if (dh == 0.0)
279  psi = M_PI_2 * (dvp + 3.0 * dvn);
280  else if (dv == 0.0)
281  psi = M_PI * dhn;
282  else
283  psi = atan(dv/dh) + M_PI * dhn * dvp
284  + (M_PI + M_PI * (dh > 0.0)) * dvn;
285  return psi * (180.0*M_1_PI);
286 #endif
287  }
#define M_1_PI
Definition: mathutil.h:12
#define M_PI
Definition: mathutil.h:9
T dot(const VT &rhs) const
Definition: VVector.h:174
VVector< T, 3 > cross(const VVector< T, 3 > &rhs) const
Definition: VVector.h:181
template<class T, unsigned int D>
T VVector< T, D >::avg ( ) const
inline

Definition at line 212 of file VVector.h.

212 { return sum()/D; }
T sum() const
Definition: VVector.h:188
template<class T, unsigned int D>
TPtr VVector< T, D >::begin ( )
inline
template<class T, unsigned int D>
CTPtr VVector< T, D >::begin ( ) const
inline

Definition at line 38 of file VVector.h.

38 { return val; }
T val[D]
Definition: VVector.h:304
template<class T, unsigned int D>
VT& VVector< T, D >::clamp ( const VT lb,
const VT ub 
)
inline

Definition at line 253 of file VVector.h.

Referenced by EMDRect::clamp(), ExpectationMap::getPropVec(), and EMDRect::ratePropVec().

253  {
254  CTPtr sv=lb.begin();
255  CTPtr uv=ub.begin();
256  for(TPtr pv=begin(); pv!=end(); pv++, sv++, uv++) {
257  if(*pv > *uv) *pv = *uv;
258  else if(*pv < *sv) *pv = *sv;
259  }
260  return *this;
261  }
T * TPtr
Definition: VVector.h:18
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT& VVector< T, D >::clampLB ( const VT lb)
inline

Definition at line 241 of file VVector.h.

Referenced by Searcher::cleanFlags(), and ExpectationMap::correctLBUB().

241  {
242  CTPtr sv=lb.begin();
243  for(TPtr pv=begin(); pv!=end(); pv++, sv++)
244  if(*pv < *sv) *pv = *sv;
245  return *this;
246  }
T * TPtr
Definition: VVector.h:18
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT& VVector< T, D >::clampUB ( const VT ub)
inline

Definition at line 247 of file VVector.h.

Referenced by Searcher::cleanFlags(), and ExpectationMap::correctLBUB().

247  {
248  CTPtr sv=ub.begin();
249  for(TPtr pv=begin(); pv!=end(); pv++, sv++)
250  if(*pv > *sv) *pv = *sv;
251  return *this;
252  }
T * TPtr
Definition: VVector.h:18
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VVector<T, 3> VVector< T, D >::cross ( const VVector< T, 3 > &  rhs) const
inline

Definition at line 181 of file VVector.h.

181  {
182  VVector<T, 3> r;
183  r.val[0]= val[1]*rhs.val[2] - val[2]*rhs.val[1];
184  r.val[1]= val[2]*rhs.val[0] - val[0]*rhs.val[2];
185  r.val[2]= r.val[2] = val[0]*rhs.val[1] - val[1]*rhs.val[0];
186  return r;
187  }
T val[D]
Definition: VVector.h:304
template<class T, unsigned int D>
T VVector< T, D >::dot ( const VT rhs) const
inline

Definition at line 174 of file VVector.h.

174  {
175  T r= TTrait::zero();
176  for(CTPtr pv=begin(), *sv=rhs.begin(); pv!=end(); pv++, sv++)
177  r += *pv * *sv;
178  return r;
179  }
static T zero()
Definition: VVector.h:6
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
TPtr VVector< T, D >::end ( )
inline

Definition at line 39 of file VVector.h.

39 { return &val[D]; }
T val[D]
Definition: VVector.h:304
template<class T, unsigned int D>
CTPtr VVector< T, D >::end ( ) const
inline

Definition at line 40 of file VVector.h.

40 { return &val[D]; }
T val[D]
Definition: VVector.h:304
template<class T, unsigned int D>
unsigned int VVector< T, D >::majorComponent ( ) const
inline

Definition at line 232 of file VVector.h.

232  {
233  T mv=TTrait::zero();
234  unsigned int mc=0,cc=0;
235  for(CTPtr pv=begin(); pv!=end(); pv++, cc++) {
236  T apv = abs(*pv);
237  if(mv < apv) { mv = apv; mc = cc; }
238  }
239  return mc;
240  }
static T zero()
Definition: VVector.h:6
const T * CTPtr
Definition: VVector.h:19
DMatrix< T > & abs(DMatrix< T > &mat)
Definition: DMatrixUtil.h:132
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
T VVector< T, D >::maxVal ( ) const
inline

Definition at line 220 of file VVector.h.

220  {
221  T mv=val[0];
222  for(CTPtr pv=begin(); pv!=end(); pv++)
223  if(mv < *pv) mv = *pv;
224  return mv;
225  }
T val[D]
Definition: VVector.h:304
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
T VVector< T, D >::minVal ( ) const
inline

Definition at line 226 of file VVector.h.

226  {
227  T mv=val[0];
228  for(CTPtr pv=begin(); pv!=end(); pv++)
229  if(mv > *pv) mv = *pv;
230  return mv;
231  }
T val[D]
Definition: VVector.h:304
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
T VVector< T, D >::norm ( ) const
inline

Definition at line 206 of file VVector.h.

206 { return sqrt(norm2()); }
T norm2() const
Definition: VVector.h:200
DMatrix< T > & sqrt(DMatrix< T > &mat)
Definition: DMatrixUtil.h:81
template<class T, unsigned int D>
T VVector< T, D >::norm2 ( ) const
inline

Definition at line 200 of file VVector.h.

200  {
201  T n= TTrait::zero();
202  for(CTPtr pv=begin(); pv!=end(); pv++)
203  n += *pv * *pv;
204  return n;
205  }
static T zero()
Definition: VVector.h:6
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
T VVector< T, D >::normalize ( )
inline

Definition at line 207 of file VVector.h.

207  {
208  T n = norm();
209  operator*=(TTrait::one()/n);
210  return n;
211  }
T norm() const
Definition: VVector.h:206
static T one()
Definition: VVector.h:7
VT & operator*=(const VT &rhs)
Definition: VVector.h:105
template<class T, unsigned int D>
static VT VVector< T, D >::one ( )
inlinestatic

Definition at line 35 of file VVector.h.

35 { return VT(TTrait::one()); }
static T one()
Definition: VVector.h:7
VVector< T, D > VT
Definition: VVector.h:17
template<class T, unsigned int D>
VT VVector< T, D >::operator* ( const VT rhs) const
inline

Definition at line 146 of file VVector.h.

146  {
147  VT r(*this);
148  return r*=rhs;
149  }
VVector< T, D > VT
Definition: VVector.h:17
template<class T, unsigned int D>
VT VVector< T, D >::operator* ( const T &  rhs) const
inline

Definition at line 160 of file VVector.h.

160  {
161  return (VT(*this) *= rhs);
162  }
VVector< T, D > VT
Definition: VVector.h:17
template<class T, unsigned int D>
VT& VVector< T, D >::operator*= ( const VT rhs)
inline

Definition at line 105 of file VVector.h.

105  {
106  CTPtr sv=rhs.begin();
107  for(TPtr pv=begin(); pv!=end(); pv++, sv++)
108  *pv *= *sv;
109  return *this;
110  }
T * TPtr
Definition: VVector.h:18
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT& VVector< T, D >::operator*= ( const T &  rhs)
inline

Definition at line 127 of file VVector.h.

127  {
128  for(TPtr pv=begin(); pv!=end(); pv++)
129  *pv *= rhs;
130  return *this;
131  }
T * TPtr
Definition: VVector.h:18
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT VVector< T, D >::operator+ ( const VT rhs) const
inline

Definition at line 138 of file VVector.h.

138  {
139  VT r(*this);
140  return r+=rhs;
141  }
VVector< T, D > VT
Definition: VVector.h:17
template<class T, unsigned int D>
VT VVector< T, D >::operator+ ( const T &  rhs) const
inline

Definition at line 154 of file VVector.h.

154  {
155  return (VT(*this) += rhs);
156  }
VVector< T, D > VT
Definition: VVector.h:17
template<class T, unsigned int D>
VT& VVector< T, D >::operator+= ( const VT rhs)
inline

Definition at line 93 of file VVector.h.

93  {
94  CTPtr sv=rhs.begin();
95  for(TPtr pv=begin(); pv!=end(); pv++, sv++)
96  *pv += *sv;
97  return *this;
98  }
T * TPtr
Definition: VVector.h:18
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT& VVector< T, D >::operator+= ( const T &  rhs)
inline

Definition at line 117 of file VVector.h.

117  {
118  for(TPtr pv=begin(); pv!=end(); pv++)
119  *pv += rhs;
120  return *this;
121  }
T * TPtr
Definition: VVector.h:18
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT VVector< T, D >::operator- ( const VT rhs) const
inline

Definition at line 142 of file VVector.h.

142  {
143  VT r(*this);
144  return r-=rhs;
145  }
VVector< T, D > VT
Definition: VVector.h:17
template<class T, unsigned int D>
VT VVector< T, D >::operator- ( const T &  rhs) const
inline

Definition at line 157 of file VVector.h.

157  {
158  return (VT(*this) -= rhs);
159  }
VVector< T, D > VT
Definition: VVector.h:17
template<class T, unsigned int D>
VT& VVector< T, D >::operator-= ( const VT rhs)
inline

Definition at line 99 of file VVector.h.

99  {
100  CTPtr sv=rhs.begin();
101  for(TPtr pv=begin(); pv!=end(); pv++, sv++)
102  *pv -= *sv;
103  return *this;
104  }
T * TPtr
Definition: VVector.h:18
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT& VVector< T, D >::operator-= ( const T &  rhs)
inline

Definition at line 122 of file VVector.h.

122  {
123  for(TPtr pv=begin(); pv!=end(); pv++)
124  *pv -= rhs;
125  return *this;
126  }
T * TPtr
Definition: VVector.h:18
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT VVector< T, D >::operator/ ( const VT rhs) const
inline

Definition at line 150 of file VVector.h.

150  {
151  VT r(*this);
152  return r/=rhs;
153  }
VVector< T, D > VT
Definition: VVector.h:17
template<class T, unsigned int D>
VT VVector< T, D >::operator/ ( const T &  rhs) const
inline

Definition at line 163 of file VVector.h.

163  {
164  return (VT(*this) /= rhs);
165  }
VVector< T, D > VT
Definition: VVector.h:17
template<class T, unsigned int D>
VT& VVector< T, D >::operator/= ( const VT rhs)
inline

Definition at line 111 of file VVector.h.

111  {
112  CTPtr sv=rhs.begin();
113  for(TPtr pv=begin(); pv!=end(); pv++, sv++)
114  *pv /= *sv;
115  return *this;
116  }
T * TPtr
Definition: VVector.h:18
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT& VVector< T, D >::operator/= ( const T &  rhs)
inline

Definition at line 132 of file VVector.h.

132  {
133  for(TPtr pv=begin(); pv!=end(); pv++)
134  *pv /= rhs;
135  return *this;
136  }
T * TPtr
Definition: VVector.h:18
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
bool VVector< T, D >::operator< ( const VT rhs) const
inline

Definition at line 51 of file VVector.h.

51  {
52  CTPtr sv=rhs.begin();
53  for(CTPtr pv=begin(); pv!=end(); pv++, sv++)
54  if(*pv >= *sv) return false;
55  return true;
56  }
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
bool VVector< T, D >::operator<= ( const VT rhs) const
inline

Definition at line 63 of file VVector.h.

63  {
64  CTPtr sv=rhs.begin();
65  for(CTPtr pv=begin(); pv!=end(); pv++, sv++)
66  if(*pv > *sv) return false;
67  return true;
68  }
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT& VVector< T, D >::operator= ( const T &  rhs)
inline

Definition at line 76 of file VVector.h.

76  {
77  for(TPtr pv=begin(); pv!=end(); pv++)
78  *pv = rhs;
79  return *this;
80  }
T * TPtr
Definition: VVector.h:18
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT& VVector< T, D >::operator= ( CTPtr  rhs)
inline

Definition at line 81 of file VVector.h.

81  {
82  for(TPtr pv=begin(); pv!=end(); pv++, rhs++)
83  *pv = *rhs;
84  return *this;
85  }
T * TPtr
Definition: VVector.h:18
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT& VVector< T, D >::operator= ( const VT rhs)
inline

Definition at line 86 of file VVector.h.

86  {
87  CTPtr sv=rhs.begin();
88  for(TPtr pv=begin(); pv!=end(); pv++, sv++)
89  *pv = *sv;
90  return *this;
91  }
T * TPtr
Definition: VVector.h:18
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
bool VVector< T, D >::operator== ( const VT rhs) const
inline

Definition at line 45 of file VVector.h.

45  {
46  CTPtr sv=rhs.begin();
47  for(CTPtr pv=begin(); pv!=end(); pv++, sv++)
48  if(*pv != *sv) return false;
49  return true;
50  }
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
bool VVector< T, D >::operator> ( const VT rhs) const
inline

Definition at line 57 of file VVector.h.

57  {
58  CTPtr sv=rhs.begin();
59  for(CTPtr pv=begin(); pv!=end(); pv++, sv++)
60  if(*pv <= *sv) return false;
61  return true;
62  }
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
bool VVector< T, D >::operator>= ( const VT rhs) const
inline

Definition at line 69 of file VVector.h.

69  {
70  CTPtr sv=rhs.begin();
71  for(CTPtr pv=begin(); pv!=end(); pv++, sv++)
72  if(*pv < *sv) return false;
73  return true;
74  }
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
const T& VVector< T, D >::operator[] ( unsigned int  i) const
inline

Definition at line 42 of file VVector.h.

42 { return val[i]; }
T val[D]
Definition: VVector.h:304
template<class T, unsigned int D>
T& VVector< T, D >::operator[] ( unsigned int  i)
inline

Definition at line 43 of file VVector.h.

43 { return val[i]; }
T val[D]
Definition: VVector.h:304
template<class T, unsigned int D>
T VVector< T, D >::prod ( ) const
inline

Definition at line 194 of file VVector.h.

194  {
195  T n= TTrait::one();
196  for(CTPtr pv=begin(); pv!=end(); pv++)
197  n *= *pv;
198  return n;
199  }
static T one()
Definition: VVector.h:7
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
static unsigned int VVector< T, D >::size ( )
inlinestatic
template<class T, unsigned int D>
VT& VVector< T, D >::sqrtEach ( )
inline

Definition at line 215 of file VVector.h.

Referenced by Searcher::cleanFlags().

215  {
216  for(TPtr pv=begin(); pv!=end(); pv++)
217  *pv = sqrt(*pv);
218  return *this;
219  }
T * TPtr
Definition: VVector.h:18
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
DMatrix< T > & sqrt(DMatrix< T > &mat)
Definition: DMatrixUtil.h:81
template<class T, unsigned int D>
T VVector< T, D >::stdev ( ) const
inline

Definition at line 214 of file VVector.h.

214 { return sqrt(var()); }
T var() const
Definition: VVector.h:213
DMatrix< T > & sqrt(DMatrix< T > &mat)
Definition: DMatrixUtil.h:81
template<class T, unsigned int D>
T VVector< T, D >::sum ( ) const
inline

Definition at line 188 of file VVector.h.

188  { //norm1
189  T n= TTrait::zero();
190  for(CTPtr pv=begin(); pv!=end(); pv++)
191  n += *pv;
192  return n;
193  }
static T zero()
Definition: VVector.h:6
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
VT& VVector< T, D >::times ( const VT rhs)
inline

Definition at line 167 of file VVector.h.

167  {
168  CTPtr sv=rhs.begin();
169  for(TPtr pv=begin(); pv!=end(); pv++, sv++)
170  *pv *= *sv;
171  return *this;
172  }
T * TPtr
Definition: VVector.h:18
const T * CTPtr
Definition: VVector.h:19
TPtr begin()
Definition: VVector.h:37
TPtr end()
Definition: VVector.h:39
template<class T, unsigned int D>
T VVector< T, D >::var ( ) const
inline

Definition at line 213 of file VVector.h.

213 { return (*this-avg()).norm2(); }
T avg() const
Definition: VVector.h:212
template<class T, unsigned int D>
static VT VVector< T, D >::zero ( )
inlinestatic

Definition at line 34 of file VVector.h.

34 { return VT(TTrait::zero()); }
static T zero()
Definition: VVector.h:6
VVector< T, D > VT
Definition: VVector.h:17

Friends And Related Function Documentation

template<class T, unsigned int D>
std::ostream& operator<< ( std::ostream &  os,
const VT rhs 
)
friend

Definition at line 289 of file VVector.h.

289  {
290  for(CTPtr pv= rhs.begin(); pv != rhs.end(); pv++) {
291  //if(pv != rhs.begin()) os << " ";
292  os << *pv << " ";
293  }
294  return os;
295  }
const T * CTPtr
Definition: VVector.h:19
template<class T, unsigned int D>
std::istream& operator>> ( std::istream &  is,
VT rhs 
)
friend

Definition at line 296 of file VVector.h.

296  {
297  for(TPtr pv=rhs.begin(); pv!=rhs.end(); pv++) {
298  is >> *pv;
299  }
300  return is;
301  }
T * TPtr
Definition: VVector.h:18

Member Data Documentation

template<class T, unsigned int D>
T VVector< T, D >::val[D]

Definition at line 304 of file VVector.h.

Referenced by VVector< float, 4 >::cross().


The documentation for this class was generated from the following file: