UltraScan III
us_vector.h
Go to the documentation of this file.
1 #ifndef US_VECTOR_H
3 #define US_VECTOR_H
4 
5 #include <QtCore>
6 #include "us_extern.h"
7 
9 class US_UTIL_EXTERN US_Vector : public QVector< double >
10 {
11  public:
15  US_Vector ( int, double = 0.0 );
16 
19  void add ( const US_Vector& );
20 
23  void add ( double );
24 
27  double dot ( const US_Vector& );
28 
31  void mult ( const US_Vector& );
32 
35  void scale ( double );
36 
39  double distance( const US_Vector& );
40 
42  double L2norm( void );
43 
45  int size( void ) const { return v.size(); };
46 
47  // Note: Trying to use [] as an lvalue gets really complicated
48  // so it's not implemented here. See Stroustrup, 3rd Edition,
49  // Section 11.12
50 
54  void assign( int i, double d ){ v[ i ] = d; };
55 
58  double operator[]( int i ) const { return v[ i ]; };
59 
60  private:
61  QVector< double > v;
62 
63 };
64 #endif
65