wvector.h

00001 
00005 #pragma once
00006 
00007 #include <usml/ublas/ublas.h>
00008 
00009 namespace usml {
00010 namespace types {
00011 
00012 using namespace usml::ublas;
00013 
00014 class wvector1; // forward reference
00015 class wposition1; // forward reference
00016 
00019 
00041 class USML_DECLSPEC wvector
00042 {
00043 
00044 public:
00045 
00046     //*********************************
00047     // initialization
00048 
00055     wvector(size_t rows = 1, size_t cols = 1);
00056 
00057     //*********************************
00058     // Rho property (includes both matrix and indexed accessors)
00059 
00060 private:
00061 
00063     matrix<double> _rho;
00064 
00065 public:
00066 
00075     inline const matrix<double>& rho() const
00076     {
00077         return _rho;
00078     }
00079 
00086     template<class E> inline
00087     void rho(const matrix_expression<E>& r, bool no_alias = true)
00088     {
00089         if (no_alias) {
00090             noalias(_rho) = r;
00091         } else {
00092             _rho = r;
00093         }
00094     }
00095 
00103     inline double rho(size_t row, size_t col) const
00104     {
00105         return _rho(row, col);
00106     }
00107 
00116     inline void rho(size_t row, size_t col, double r)
00117     {
00118         _rho(row, col) = r;
00119     }
00120 
00121     //*********************************
00122     // Theta property (includes both matrix and indexed accessors)
00123 
00124 private:
00125 
00127     matrix<double> _theta;
00128 
00129 public:
00130 
00139     inline const matrix<double>& theta() const
00140     {
00141         return _theta;
00142     }
00143 
00150     template<class E> inline
00151     void theta(const matrix_expression<E>& t, bool no_alias = true)
00152     {
00153         if (no_alias) {
00154             noalias(_theta) = t;
00155         } else {
00156             _theta = t;
00157         }
00158     }
00159 
00167     inline double theta(size_t row, size_t col) const
00168     {
00169         return _theta(row, col);
00170     }
00171 
00181     inline void theta(size_t row, size_t col, double t)
00182     {
00183         _theta(row, col) = t;
00184     }
00185 
00186     //*********************************
00187     // Phi property (includes both matrix and indexed accessors)
00188 
00189 private:
00190 
00192     matrix<double> _phi;
00193 
00194 public:
00195 
00203     inline const matrix<double>& phi() const
00204     {
00205         return _phi;
00206     }
00207 
00214     template<class E> inline
00215     void phi(const matrix_expression<E>& p, bool no_alias = true)
00216     {
00217         if (no_alias) {
00218             noalias(_phi) = p;
00219         } else {
00220             _phi = p;
00221         }
00222     }
00223 
00231     inline double phi(size_t row, size_t col) const
00232     {
00233         return _phi(row, col);
00234     }
00235 
00244     inline void phi(size_t row, size_t col, double p)
00245     {
00246         _phi(row, col) = p;
00247     }
00248 
00249     //*********************************
00250     // utilities
00251 
00255     inline size_t size1() const
00256     {
00257         return _rho.size1();
00258     }
00259 
00263     inline size_t size2() const
00264     {
00265         return _rho.size2();
00266     }
00267 
00271     inline void clear()
00272     {
00273         _rho.clear();
00274         _theta.clear();
00275         _phi.clear();
00276     }
00277 
00302     void dot(const wvector1& other, matrix<double>& result) const;
00303 
00316     void dotnorm(const wvector1& other, matrix<double>& result) const;
00317 
00330     void distance(const wvector1& origin, matrix<double>& result) const;
00331 
00344     void distance2(const wvector1& origin, matrix<double>& result) const;
00345 
00346 };
00347 
00349 } // end of ocean namespace
00350 } // end of usml namespace

Generated on 4 May 2015 for USML by  doxygen 1.6.1