Actual source code: tvecsingle.h
1: #ifndef SIMPLEFLOATVECTOR_H
2: #define SIMPLEFLOATVECTOR_H
4: #include "tao_basictypes.h"
5: #include "taovec.h"
7: class TaoVecFloatArray: public TaoVec{
9: protected:
11: int n;
12: float *v;
13: int fallocated;
14: public:
15:
16: inline int GetData(float**dd,int*nn){*dd=v;*nn=n; return 0;}
18: TaoVecFloatArray( int nn );
19: TaoVecFloatArray( int nn , float *vv);
20: ~TaoVecFloatArray(){if (n>0 && fallocated) delete [] v;};
22: virtual int Clone(TaoVec**);
23: virtual int Compatible(TaoVec*, TaoTruth*);
25: /** Set all elements of this Tao Vector to zero. */
26: virtual int SetToZero();
27: /** Set all elements of this Tao Vector to the constant value c */
28: virtual int SetToConstant( double );
30: /** Copy the elements of one vector to another */
31: virtual int CopyFrom( TaoVec* );
33: virtual int ScaleCopyFrom( double, TaoVec* );
35: /** Return the norm of this Tao Vector. */
36: virtual int NormInfinity( double* );
37: virtual int Norm1( double* );
38: virtual int Norm2( double* );
39: virtual int Norm2squared( double* );
41: /** Multiply the components of this Tao Vector by the components of v. */
42: virtual int PointwiseMultiply( TaoVec* , TaoVec* );
44: /** Divide the components of this Tao Vector by the components of v. */
45: virtual int PointwiseDivide( TaoVec* , TaoVec* );
47: /** Set the elements of one vector to the mi of corresponding elements of two compatible vectors */
48: virtual int PointwiseMaximum( TaoVec* , TaoVec*);
50: virtual int PointwiseMinimum( TaoVec* , TaoVec*);
52: virtual int Median( TaoVec* , TaoVec* , TaoVec* );
54: /** Calculate the Billups composition form of the Fischer function given
55: x, f, l, u. The smoothed version takes the smoothing parameter for each
56: component as an additional argument.
57: */
58: virtual int Fischer(TaoVec *, TaoVec *, TaoVec *, TaoVec *);
59: virtual int SFischer(TaoVec *, TaoVec *, TaoVec *, TaoVec *, double);
61: /** Scale each element of this Tao Vector by the constant alpha */
62: virtual int Scale( double );
64: /** this += alpha * x */
65: virtual int Axpy ( double , TaoVec* );
67: /** this = alpha * this + x */
68: virtual int Aypx ( double , TaoVec* );
70: virtual int Axpby ( double , TaoVec*, double );
72: /** this = alpha * x + beta *y */
73: virtual int Waxpby( double , TaoVec*, double , TaoVec* );
75: /** Take the absolute value of the elements */
76: virtual int AbsoluteValue( );
78: /** Take the minimum of the absolute value of the elements */
79: virtual int MinElement(double*);
81: /** Add c to the elements of this Tao Vector */
82: virtual int AddConstant( double );
84: /** Return the dot product of this Tao Vector with v */
85: virtual int Dot( TaoVec* , double *);
87: /** Negate all the elements of this Tao Vector. */
88: virtual int Negate();
90: /** Invert (1/x) the elements of this Tao Vector. */
91: virtual int Reciprocal();
93: /** Take square root of the elements of this Tao Vector. */
94: virtual int Sqrt();
95: virtual int Pow( double );
97: /** Get the dimension of the vector space */
98: virtual int GetDimension( int* );
100: /* View */
101: virtual int View();
103: /* stepMax */
104: virtual int StepMax2( TaoVec* , TaoVec*, TaoVec*, double* );
106: virtual int StepMax( TaoVec* , double* );
108: virtual int BoundGradientProjection(TaoVec*,TaoVec*,TaoVec*, TaoVec*);
110: /* Functionality for working in a reduced space */
112: int GetFloats(float **, int*);
113: int RestoreFloats(float **, int*);
115: };
117: #endif