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
115 const double&
operator[](
unsigned int i)
const;
154 double norm2 ()
const;
157 double norm1 ()
const;
183 void cwSet(
double value);
257 void matlabDiff (
unsigned int firstPositionToStoreDiff,
double valueForRemainderPosition,
TeuchosVector& outputVec)
const;
263 void print (std::ostream& os)
const;
266 const std::string& fileType,
267 const std::set<unsigned int>& allowedSubEnvIds);
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;
304 #endif // ifdef QUESO_HAS_TRILINOS
306 #endif //UQ_TEUCHOS_VECTOR_H
void cwSetConcatenated(const TeuchosVector &v1, const TeuchosVector &v2)
This function concatenates vectors v1 and v2 into this vector.
GslMatrix operator+(const GslMatrix &m1, const GslMatrix &m2)
void cwExtract(unsigned int initialPos, TeuchosVector &vec) const
Component-wise extracts all values of this with vector vec, starting at position initialPos.
double getMinValue() const
Returns the minimum value in the this vector.
void cwSqrt()
Component-wise sets the square-root of this.
TeuchosVector()
Default Constructor.
std::ostream & operator<<(std::ostream &os, const SequenceStatisticalOptions &obj)
void cwSetInverseGamma(const TeuchosVector &a, const TeuchosVector &b)
This function sets component-wise random variates from the Inverse Gamma distribution, with parameters given by vectors a and b.
void mpiBcast(int srcRank, const MpiComm &bcastComm)
Broadcasts a message from the process with srcRank root to all other processes of the group...
void copy_to_std_vector(std::vector< double > &vec)
Copies the values of this vector (a TeuchosVector) to a std::vector structure.
A class for partitioning vectors and matrices.
unsigned int sizeGlobal() const
Returns the global length of this vector.
bool atLeastOneComponentBiggerThan(const TeuchosVector &rhs) const
This function returns true if at least one component of this is bigger than the respective component ...
double normInf() const
Returns the infinity-norm (maximum norm) of the vector.
void cwInvert()
This function inverts component-wise the element values of this.
The QUESO MPI Communicator Class.
void print(std::ostream &os) const
Print method. Defines the behavior of the std::ostream << operator inherited from the Object class...
TeuchosVector & operator-=(const TeuchosVector &rhs)
Stores in this vector the coordinate-wise subtraction of this and rhs.
TeuchosVector & operator/=(double a)
Stores in this vector the coordinate-wise division of this by a.
~TeuchosVector()
Destructor.
void matlabDiff(unsigned int firstPositionToStoreDiff, double valueForRemainderPosition, TeuchosVector &outputVec) const
int getMaxValueIndex() const
This function returns the index of the maximum value in the vector this.
void subWriteContents(const std::string &varNamePrefix, const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds) const
double norm2Sq() const
Returns the norm of the vector, as the square root of 2-norm of this vector.
double scalarProduct(const GslVector &x, const GslVector &y)
bool atLeastOneComponentBiggerOrEqualThan(const TeuchosVector &rhs) const
This function returns true if at least one component of this is bigger than or equal to the respectiv...
unsigned int sizeLocal() const
Returns the length of this vector.
void cwSet(double value)
Component-wise sets all values to this with value.
void matlabLinearInterpExtrap(const TeuchosVector &xVec, const TeuchosVector &yVec, const TeuchosVector &xiVec)
Reproduces MATLAB linear inter/extra-polation.
void cwSetBeta(const TeuchosVector &alpha, const TeuchosVector &beta)
This function sets component-wise random variates from the Beta distribution, with vector parameters ...
GslMatrix operator-(const GslMatrix &m1, const GslMatrix &m2)
void getMinValueAndIndex(double &value, int &index)
This function returns minimum value in the vector this and its the index.
void cwSetUniform(const TeuchosVector &lowerBoundVec, const TeuchosVector &upperBoundVec)
This function sets component-wise a number uniformly distributed in the range of elements of [lowerBo...
bool operator==(const GslVector &lhs, const GslVector &rhs)
double norm2() const
Returns the 2-norm (Euclidean norm) of the vector.
int getMinValueIndex() const
This function returns the index of the minimum value in the vector this.
double getMaxValue() const
Returns the maximum value in the this vector.
Class for vector operations (virtual).
double & operator[](unsigned int i)
Element access method (non-const).
void getMaxValueAndIndex(double &value, int &index)
This function returns maximum value in the vector this and its the index.
double norm1() const
Returns the 1-norm of the vector.
GslMatrix operator*(double a, const GslMatrix &mat)
TeuchosVector abs() const
This function returns absolute value of all elements in this.
TeuchosVector & operator*=(double a)
Stores in this vector the coordinate-wise multiplication of this and a.
void cwSetGaussian(double mean, double stdDev)
This function sets component-wise Gaussian random variates, with mean mean and standard deviation std...
void sort()
This function sorts the elements of the vector this in ascending numerical order. ...
const BaseEnvironment & env() const
void copy_from_std_vector(const std::vector< double > vec)
Copies the values of std::vector structure to this vector (a TeuchosVector).
void mpiAllQuantile(double probability, const MpiComm &opComm, TeuchosVector &resultVec) const
Gathers values from a group of processes and returns all quantiles.
GslVector operator/(double a, const GslVector &x)
Teuchos::SerialDenseVector< int, double > m_vec
Teuchos vector.
void cwSetGamma(const TeuchosVector &a, const TeuchosVector &b)
This function sets component-wise random variates from the Inverse Gamma distribution, with parameters given by vectors a and b.
double sumOfComponents() const
Returns the sum of the components of the vector.
void subReadContents(const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds)
void mpiAllReduce(RawType_MPI_Op mpiOperation, const MpiComm &opComm, TeuchosVector &resultVec) const
Combines values from all processes and distributes the result back to all processes.
void copy(const TeuchosVector &src)
This function copies the elements of the vector src into this.
Class for vector operations using Teuchos (Trilinos).
TeuchosVector & operator+=(const TeuchosVector &rhs)
Stores in this vector the coordinate-wise addition of this and rhs.
TeuchosVector & operator=(double a)
Set all values in the vector to a constant value.
bool atLeastOneComponentSmallerOrEqualThan(const TeuchosVector &rhs) const
This function returns true if at least one component of this is smaller than or equal to the respecti...
bool atLeastOneComponentSmallerThan(const TeuchosVector &rhs) const
This function returns true if at least one component of this is smaller than the respective component...
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...