Home
Install
Use
Develop
Support
News
Credits
hosted by
|
21 template < unsigned N, typename T>
26 { for ( unsigned i=0; i<N; i++) v.x[i] = T(0.0); }
29 template< unsigned M, typename U>
37 Vector () { zero (* this); }
43 { x[0] = x0; x[1] = x1; }
46 { x[0] = x0; x[1] = x1; x[2] = x2; }
48 Vector (T x0, T x1, T x2, T x3)
49 { x[0] = x0; x[1] = x1; x[2] = x2; x[3] = x3; }
57 { for ( unsigned i=0; i<N; i++) x[i] = T(s.x[i]); return * this; }
61 { x[0] = scalar; for ( unsigned i=1; i<N; i++) x[i] = 0.0; return * this; }
65 { for ( unsigned i=0; i<N; i++) x[i] += s.x[i]; return * this; }
69 { for ( unsigned i=0; i<N; i++) x[i] -= s.x[i]; return * this; }
79 { for ( unsigned i=0; i<N; i++) x[i] *= a; return * this; }
84 { for ( unsigned i=0; i<N; i++) x[i] /= a; return * this; }
88 { for( unsigned i=0; i<N; i++) if(x[i]!=b.x[i]) return false; return true; }
114 { T r=0; for ( unsigned i=0; i<N; i++) r += a[i]*b[i]; return r; }
122 { for ( unsigned i=0; i<N; i++) s.x[i] = -s.x[i]; return s; }
133 unsigned size () const { return N; }
137 { Vector v; v[i] = 1.0; return v; }
142 template < typename T>
147 for ( unsigned i=0; i<3; i++) {
148 j = (i+1)%3; k = (i+2)%3;
149 result[i] = a[j]*b[k] - a[k]*b[j];
155 template < typename T>
156 T normsq ( const T& v)
161 template < typename T>
162 T normsq ( const std::complex<T>& v)
167 template < typename T, typename U=T>
174 template < unsigned N, typename T>
177 T sum = normsq(v[0]);
178 for ( unsigned i=1; i < N; i++)
184 template < unsigned N, template< typename T> class V, typename U >
185 U normsq ( const Vector< N, V<U> >& v)
187 U sum = normsq(v[0]);
188 for ( unsigned i=1; i < N; i++)
194 template < unsigned N, typename T>
197 return sqrt(normsq(v));
201 template< unsigned N, typename T>
205 for ( unsigned i=0; i < N; i++)
206 result[i] = input[i].real();
210 template< unsigned N, typename T>
214 for ( unsigned i=0; i < N; i++)
215 result[i] = input[i].imag();
219 template< unsigned N, typename T>
223 for ( unsigned i=0; i < N; i++)
224 result[i] = std::conj(input[i]);
228 template< unsigned N, typename T>
231 for ( unsigned i=0; i < N; i++)
232 if (!myfinite( input[i] ))
242 static inline unsigned ndim () { return N; }
243 static inline T& element ( Vector<N,T>& t, unsigned i)
245 static inline const T element ( const Vector<N,T>& t, unsigned i)
250 template< unsigned N, typename T>
251 std::ostream& operator<< (std::ostream& ostr, const Vector<N,T>& v)
254 for ( unsigned i=1; i<N; i++)
259 template< unsigned N, typename T>
260 std::istream& operator >> (std::istream& is, Vector<N,T>& v)
266 is.setstate(std::istream::failbit);
272 for ( unsigned i=1; i<N; i++)
276 is.setstate(std::istream::failbit);
284 is.setstate(std::istream::failbit);
Vector & operator-=(const Vector &s)
friend const friend Vector operator*(Vector a, T c)
friend const friend Vector operator+(Vector a, const Vector< N, U > &b)
Estimates with a value, , and a variance, . Definition: Estimate.h:33
Vector & operator+=(const Vector &s)
Vector. Definition: Vector.h:22
Vector & operator*=(const U &a)
bool operator==(const Vector &b) const
bool operator!=(const Vector &b) const
static const Vector basis(unsigned i)
friend const friend Vector operator-(Vector a, const Vector< N, U > &b)
Vector & operator/=(const U &a)
Vector & operator=(const Vector< N, U > &s)
T & operator[](unsigned n)
Traits of the data type. Definition: Traits.h:70
friend const friend Vector operator/(Vector a, T c)
Generated using doxygen 1.8.17
|