C++ main module for mmsd Package  1.0
LAP_ConstDoubleVector.h
Go to the documentation of this file.
1 #ifndef LAP_ConstDoubleVector_H
2 #define LAP_ConstDoubleVector_H
3 
4 #include "LAP_ConstVector.h"
5 #include "CORE_ListPointers.h"
6 
7 #include "dvector_functions.h"
8 
9 class LAP_DoubleVector;
10 
11 
21 
24 
25 class LAP_ConstDoubleVector: public LAP_ConstVector<lapack_real> {
26 
27  SP_OBJECT(LAP_ConstDoubleVector);
28 
29  private:
30  // ATTRIBUTES
31 
32 
33  // ASSOCIATIONS
34 
35  // METHODS
36 
37 
38  public:
39  // CONSTRUCTORS
42 
43 
44 
45  // DESTRUCTORS
48  virtual ~LAP_ConstDoubleVector();
49 
50  public:
51 
52 
53  // -------------
54  // NEW METHODS
55  // -------------
56  public:
59  inline static SP::LAP_ConstDoubleVector New() {
60  SP::LAP_ConstDoubleVector p(new LAP_ConstDoubleVector(),
62  p->setThis(p);
63  return p;
64  };
65 
66 
67 
68  // ----------------
69  // vector product
70  // ----------------
71 
72 
76  double product(const LAP_DoubleVector& x) const;
77 
78 
82  double product(const LAP_ConstDoubleVector& x) const {
83  if (x.getSize()!=getSize())
84  throw LAP_Exception("math/linalg/core","LAP_DoubleVector::Product","incompatible dimension of vector");
85  return DoubleVectorDot(x.getSize(),x.getIncrement(),&x(0),
86  getIncrement(),&(*this)(0));
87  }
88 
89 
90  inline static double product(const LAP_ConstDoubleVector& v,
91  const LAP_ConstDoubleVector& w) {
92  return v.product(w);
93  }
94 
95 
100  return DoubleVectorIndexMax(getSize(),getIncrement(),&(*this)(0));
101  }
104  tLVectorIndex indexMin() const;
105 
110  double norm1() const {
111  return DoubleVectorNorm1(getSize(),getIncrement(),&(*this)(0));
112  }
113 
117  double sum() const;
118 
122  double norm2() const {
123  return DoubleVectorNorm2(getSize(),getIncrement(),&(*this)(0));
124  }
127  inline double normInf() const {
128  return fabs((*this)(indexMax()));
129  };
130 
133  double distance2(const LAP_DoubleVector& b) const;
134 
137  double distance2(const LAP_ConstDoubleVector& b) const;
138 
141  inline double distance2(SPC::LAP_DoubleVector b) const {
142  if (b.get()!=null) return distance2(*b.get());
143  return 0;
144  };
147  inline double distance2(SPC::LAP_ConstDoubleVector b) const {
148  if (b.get()!=null) return distance2(*b.get());
149  return 0;
150  };
151 
152 
153 };
154 #endif
virtual ~LAP_ConstDoubleVector()
destroy a vector
Definition: LAP_ConstDoubleVector.cpp:9
this class describes the exceptions raised for LAP package
Definition: LAP_Exception.h:14
tLVectorIndex indexMax() const
return the i such that |xi| is maximum idamax blas method called
Definition: LAP_ConstDoubleVector.h:99
static SP::LAP_ConstDoubleVector New()
create a new vector of double
Definition: LAP_ConstDoubleVector.h:59
double product(const LAP_DoubleVector &x) const
return result= the view is taken into account ddot blas method called
Definition: LAP_ConstDoubleVector.cpp:15
Definition: LAP_DoubleVector.h:20
tLVectorIndex getSize() const
get the size of the vector
Definition: LAP_ConstVector.h:170
double norm1() const
return the sum(|xi|) dasum blas method called
Definition: LAP_ConstDoubleVector.h:110
#define null
Definition: types.h:13
tLVectorIndex DoubleVectorIndexMax(const tLVectorIndex &nX, const tLVectorIncrement &incX, const double *x)
Definition: dvector_functions.cpp:175
tLVectorIndex indexMin() const
return the i such that |xi| is minimum
Definition: LAP_ConstDoubleVector.cpp:27
double DoubleVectorNorm2(const tLVectorIndex &nX, const tLVectorIncrement &incX, const double *x)
Definition: dvector_functions.cpp:192
double norm2() const
return the sqrt(sum([xi|^2)) dnrm2 blas method called
Definition: LAP_ConstDoubleVector.h:122
double distance2(SPC::LAP_ConstDoubleVector b) const
return the norm2 of (this-b)
Definition: LAP_ConstDoubleVector.h:147
#define tLVectorIndex
Definition: lapack_types.h:13
double product(const LAP_ConstDoubleVector &x) const
return result= the view is taken into account ddot blas method called
Definition: LAP_ConstDoubleVector.h:82
double distance2(SPC::LAP_DoubleVector b) const
return the norm2 of (this-b)
Definition: LAP_ConstDoubleVector.h:141
double distance2(const LAP_DoubleVector &b) const
return the norm2 of (this-b)
Definition: LAP_ConstDoubleVector.cpp:96
LAP_ConstDoubleVector()
build a vector
Definition: LAP_ConstDoubleVector.cpp:5
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_ConstVector.h:175
DEFINE_SVPTR(LAP_ConstDoubleVector)
double DoubleVectorDot(const tLVectorIndex &nX, const tLVectorIncrement &incX, const double *x, const tLVectorIncrement &incY, const double *y)
Definition: dvector_functions.cpp:139
double sum() const
return the sum(xi) dasum blas method called
Definition: LAP_ConstDoubleVector.cpp:132
DEFINE_SPTR(LAP_ConstDoubleVector)
Definition: LAP_ConstDoubleVector.h:25
double normInf() const
return the the maximum value of [xi|
Definition: LAP_ConstDoubleVector.h:127
this class describes a vector of const double
Definition: LAP_ConstVector.h:14
double DoubleVectorNorm1(const tLVectorIndex &nX, const tLVectorIncrement &incX, const double *x)
Definition: dvector_functions.cpp:184
static double product(const LAP_ConstDoubleVector &v, const LAP_ConstDoubleVector &w)
Definition: LAP_ConstDoubleVector.h:90
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106