25 #ifndef UQ_TEUCHOS_VECTOR_H
26 #define UQ_TEUCHOS_VECTOR_H
28 #ifdef QUESO_HAS_TRILINOS
29 #include <Teuchos_SerialDenseVector.hpp>
30 #include <Teuchos_SerialDenseMatrix.hpp>
31 #include <Teuchos_LAPACK.hpp>
34 #include <queso/Defines.h>
35 #include <queso/Vector.h>
38 #ifdef QUESO_HAS_TRILINOS
55 class TeuchosVector :
public Vector
63 TeuchosVector(
const BaseEnvironment& env,
const Map& map);
66 TeuchosVector(
const BaseEnvironment& env,
const Map& map,
double value);
69 TeuchosVector(
const BaseEnvironment& env,
double d1,
double d2,
const Map& map);
72 TeuchosVector(
const TeuchosVector& v,
double d1,
double d2);
75 TeuchosVector(
const TeuchosVector& y);
84 TeuchosVector& operator= (
double a);
88 TeuchosVector& operator= (
const TeuchosVector& rhs);
91 TeuchosVector& operator*=(
double a);
94 TeuchosVector& operator/=(
double a);
97 TeuchosVector& operator*=(
const TeuchosVector& rhs);
100 TeuchosVector& operator/=(
const TeuchosVector& rhs);
103 TeuchosVector& operator+=(
const TeuchosVector& rhs);
106 TeuchosVector& operator-=(
const TeuchosVector& rhs);
111 double& operator[](
unsigned int i);
115 const double& operator[](
unsigned int i)
const;
120 unsigned int sizeLocal ()
const;
124 unsigned int sizeGlobal ()
const;
130 double getMaxValue ()
const;
133 double getMinValue ()
const;
136 int getMaxValueIndex ()
const;
139 int getMinValueIndex ()
const;
142 void getMaxValueAndIndex(
double& value,
int& index );
145 void getMinValueAndIndex(
double& value,
int& index );
150 double norm2Sq ()
const;
154 double norm2 ()
const;
157 double norm1 ()
const;
160 double normInf ()
const;
168 bool atLeastOneComponentSmallerThan (
const TeuchosVector& rhs)
const;
172 bool atLeastOneComponentBiggerThan (
const TeuchosVector& rhs)
const;
175 bool atLeastOneComponentSmallerOrEqualThan(
const TeuchosVector& rhs)
const;
178 bool atLeastOneComponentBiggerOrEqualThan (
const TeuchosVector& rhs)
const;
183 void cwSet(
double value);
187 void cwSet(
unsigned int initialPos,
const TeuchosVector& vec);
190 void cwExtract(
unsigned int initialPos, TeuchosVector& vec)
const;
199 void cwSetConcatenated(
const TeuchosVector& v1,
const TeuchosVector& v2);
202 void cwSetGaussian(
double mean,
double stdDev);
205 void cwSetGaussian(
const TeuchosVector& meanVec,
const TeuchosVector& stdDevVec);
208 void cwSetUniform (
const TeuchosVector& lowerBoundVec,
const TeuchosVector& upperBoundVec);
211 void cwSetBeta (
const TeuchosVector& alpha,
const TeuchosVector& beta );
214 void cwSetGamma (
const TeuchosVector& a,
const TeuchosVector& b );
217 void cwSetInverseGamma(
const TeuchosVector& a,
const TeuchosVector& b );
224 TeuchosVector abs()
const;
228 void copy_to_std_vector(std::vector<double>& vec);
232 void copy_from_std_vector(
const std::vector<double> vec);
239 double sumOfComponents ()
const;
242 void mpiBcast (
int srcRank,
const MpiComm& bcastComm);
245 void mpiAllReduce (
RawType_MPI_Op mpiOperation,
const MpiComm& opComm, TeuchosVector& resultVec)
const;
248 void mpiAllQuantile (
double probability,
const MpiComm& opComm, TeuchosVector& resultVec)
const;
254 void matlabLinearInterpExtrap(
const TeuchosVector& xVec,
const TeuchosVector& yVec,
const TeuchosVector& xiVec);
257 void matlabDiff (
unsigned int firstPositionToStoreDiff,
double valueForRemainderPosition, TeuchosVector& outputVec)
const;
263 void print (std::ostream& os)
const;
265 void subReadContents (
const std::string& fileName,
266 const std::string& fileType,
267 const std::set<unsigned int>& allowedSubEnvIds);
268 void subWriteContents (
const std::string& varNamePrefix,
269 const std::string& fileName,
270 const std::string& fileType,
271 const std::set<unsigned int>& allowedSubEnvIds)
const;
284 Teuchos::SerialDenseVector<int,double> m_vec;
287 void copy (
const TeuchosVector& src);
292 TeuchosVector
operator/ (
double a,
const TeuchosVector& x );
293 TeuchosVector
operator/ (
const TeuchosVector& x,
const TeuchosVector& y );
294 TeuchosVector
operator* (
double a,
const TeuchosVector& x );
295 TeuchosVector
operator* (
const TeuchosVector& x,
const TeuchosVector& y );
296 double scalarProduct(
const TeuchosVector& x,
const TeuchosVector& y );
297 TeuchosVector
operator+ (
const TeuchosVector& x,
const TeuchosVector& y );
298 TeuchosVector
operator- (
const TeuchosVector& x,
const TeuchosVector& y );
299 bool operator== (
const TeuchosVector& lhs,
const TeuchosVector& rhs);
300 std::ostream&
operator<< (std::ostream& os,
const TeuchosVector& obj);
304 #endif // ifdef QUESO_HAS_TRILINOS
306 #endif //UQ_TEUCHOS_VECTOR_H
GslMatrix operator*(double a, const GslMatrix &mat)
std::ostream & operator<<(std::ostream &os, const BaseEnvironment &obj)
GslVector operator/(double a, const GslVector &x)
GslMatrix operator+(const GslMatrix &m1, const GslMatrix &m2)
double scalarProduct(const GslVector &x, const GslVector &y)
GslMatrix operator-(const GslMatrix &m1, const GslMatrix &m2)
bool operator==(const GslVector &lhs, const GslVector &rhs)
and that you are informed that you can do these things To protect your we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it For if you distribute copies of the whether gratis or for a you must give the recipients all the rights that we gave you You must make sure that receive or can get the source code If you link other code with the you must provide complete object files to the so that they can relink them with the library after making changes to the library and recompiling it And you must show them these terms so they know their rights We protect your rights with a two step which gives you legal permission to copy