Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef SUNDANCE_EVALVECTOR_H
00043 #define SUNDANCE_EVALVECTOR_H
00044
00045 #include "SundanceDefs.hpp"
00046 #include "Teuchos_RefCountPtr.hpp"
00047 #include "Teuchos_Array.hpp"
00048 #include "SundanceObjectWithVerbosity.hpp"
00049 #include "SundanceUnaryFunctor.hpp"
00050 #include "SundanceNoncopyable.hpp"
00051
00052
00053 namespace Sundance
00054 {
00055 using namespace Teuchos;
00056 class TempStack;
00057
00058
00059
00060 class EvalVector : public Noncopyable,
00061 public ObjectWithClassVerbosity<EvalVector>
00062 {
00063 friend class EvalManager;
00064 friend class TempStack;
00065
00066 private:
00067
00068
00069 EvalVector(TempStack* s);
00070
00071
00072 EvalVector(TempStack* s, const RCP<Array<double> >& data,
00073 const std::string& str);
00074
00075
00076 public:
00077
00078
00079
00080
00081
00082 ~EvalVector();
00083
00084
00085
00086
00087
00088 void add_SV(const double& alpha,
00089 const EvalVector* B) ;
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 void add_SVV(const double& alpha,
00100 const EvalVector* B,
00101 const EvalVector* C) ;
00102
00103
00104 void add_V(const EvalVector* A) ;
00105
00106
00107 void add_S(const double& alpha);
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117 void add_VV(const EvalVector* A,
00118 const EvalVector* B) ;
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129 void multiply_S_add_SV(const double& alpha,
00130 const double& beta,
00131 const EvalVector* C) ;
00132
00133
00134
00135
00136
00137
00138
00139
00140 void multiply_S_add_S(const double& alpha,
00141 const double& beta) ;
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151 void multiply_V_add_VVV(const EvalVector* A,
00152 const EvalVector* B,
00153 const EvalVector* C,
00154 const EvalVector* D) ;
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 void multiply_V_add_SVV(const EvalVector* A,
00166 const double& beta,
00167 const EvalVector* C,
00168 const EvalVector* D) ;
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 void multiply_V_add_SV(const EvalVector* A,
00179 const double& beta,
00180 const EvalVector* C) ;
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190 void multiply_VV(const EvalVector* A,
00191 const EvalVector* B) ;
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201 void multiply_SV(const double& alpha,
00202 const EvalVector* B) ;
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212 void multiply_V(const EvalVector* A) ;
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222 void multiply_S(const double& alpha) ;
00223
00224
00225
00226
00227 void setTo_S_add_SVV(const double& alpha,
00228 const double& beta,
00229 const EvalVector* C,
00230 const EvalVector* D);
00231
00232
00233
00234
00235 void setTo_S_add_VV(const double& alpha,
00236 const EvalVector* B,
00237 const EvalVector* C);
00238
00239
00240
00241
00242 void setTo_S_add_SV(const double& alpha,
00243 const double& beta,
00244 const EvalVector* C);
00245
00246
00247
00248
00249 void setTo_S_add_V(const double& alpha,
00250 const EvalVector* B);
00251
00252
00253
00254
00255
00256 void setTo_V(const EvalVector* A);
00257
00258
00259
00260
00261 void setTo_VV(const EvalVector* A,
00262 const EvalVector* B);
00263
00264
00265
00266
00267 void setTo_SV(const double& alpha,
00268 const EvalVector* B);
00269
00270
00271
00272
00273 void setTo_SVV(const double& alpha,
00274 const EvalVector* B,
00275 const EvalVector* C);
00276
00277
00278
00279
00280
00281
00282
00283 void setToConstant(const double& alpha) ;
00284
00285
00286
00287
00288 void applyUnaryOperator(const UnaryFunctor* func,
00289 Array<RCP<EvalVector> >& opDerivs);
00290
00291
00292
00293 RCP<EvalVector> clone() const ;
00294
00295
00296 void resize(int n);
00297
00298
00299 int length() const {return data_->size();}
00300
00301
00302 void print(std::ostream& os) const ;
00303
00304
00305 const double * start() const {return &((*data_)[0]);}
00306
00307
00308 double * start() {return &((*data_)[0]);}
00309
00310 const std::string& str() const {return str_;}
00311
00312 void setString(const std::string& str) {str_ = str;}
00313
00314 inline static bool& shadowOps() {static bool rtn = false; return rtn;}
00315
00316 bool isValid() const {return data_.get() != 0 && s_ != 0;}
00317
00318
00319
00320
00321 inline static double& totalFlops() {static double rtn = 0; return rtn;}
00322
00323 private:
00324
00325 inline static void addFlops(const double& flops) {totalFlops() += flops;}
00326
00327 mutable TempStack* s_;
00328
00329 RCP<Array<double> > data_;
00330
00331 std::string str_;
00332
00333 };
00334
00335
00336
00337 }
00338
00339 namespace std
00340 {
00341 inline ostream& operator<<(std::ostream& os,
00342 const Sundance::EvalVector& vec)
00343 {
00344 vec.print(os);
00345 return os;
00346 }
00347 }
00348
00349
00350 #endif