25 #include <queso/GslVector.h>
26 #include <queso/Defines.h>
27 #include <gsl/gsl_sort_vector.h>
38 "GslVector::constructor(), default",
39 "should not be used by user");
45 m_vec (gsl_vector_calloc(map.NumGlobalElements()))
51 "GslVector::constructor(1)",
52 "null vector generated");
56 "GslVector::constructor(1)",
57 "incompatible local vec size");
61 "GslVector::constructor(1)",
62 "incompatible global vec size");
66 "GslVector::constructor(1)",
67 "incompatible own vec size");
81 m_vec (gsl_vector_calloc(map.NumGlobalElements()))
87 "GslVector::constructor(2)",
88 "null vector generated");
92 "GslVector::constructor(2)",
93 "incompatible local vec size");
97 "GslVector::constructor(2)",
98 "incompatible global vec size");
104 "GslVector::constructor(2)",
105 "incompatible own vec size");
113 m_vec (gsl_vector_calloc(map.NumGlobalElements()))
119 "GslVector::constructor(3), linspace",
120 "null vector generated");
124 "GslVector::constructor(3)",
125 "incompatible local vec size");
129 "GslVector::constructor(3)",
130 "incompatible global vec size");
132 for (
unsigned int i = 0; i <
m_vec->size; ++i) {
133 double alpha = (double) i / ((
double)
m_vec->size - 1.);
134 (*this)[i] = (1.-alpha)*d1 + alpha*d2;
139 "GslVector::constructor(3)",
140 "incompatible own vec size");
148 m_vec (gsl_vector_calloc(v.sizeLocal()))
154 "GslVector::constructor(4), linspace",
155 "null vector generated");
159 "GslVector::constructor(4)",
160 "incompatible local vec size");
164 "GslVector::constructor(4)",
165 "incompatible global vec size");
167 for (
unsigned int i = 0; i <
m_vec->size; ++i) {
168 double alpha = (double) i / ((
double)
m_vec->size - 1.);
169 (*this)[i] = (1. - alpha) * start + alpha * end;
174 "GslVector::constructor(4)",
175 "incompatible own vec size");
183 m_vec (gsl_vector_calloc(v.sizeLocal()))
190 "GslVector::constructor(5), copy",
191 "null vector generated");
195 "GslVector::constructor(5)",
196 "incompatible local vec size");
200 "GslVector::constructor(5)",
201 "incompatible global vec size");
207 "GslVector::constructor(5)",
208 "incompatible own vec size");
231 "GslVector::operator=()",
232 "sizes are not compatible");
241 iRC = gsl_vector_scale(
m_vec,a);
244 "GslVector::operator*=()",
264 "GslVector::operator*=()",
265 "different sizes of this and rhs");
267 for (
unsigned int i = 0; i < size1; ++i) {
268 (*this)[i] *= rhs[i];
281 "GslVector::operator/=()",
282 "different sizes of this and rhs");
284 for (
unsigned int i = 0; i < size1; ++i) {
285 (*this)[i] /= rhs[i];
298 "GslVector::operator+=()",
310 "GslVector::operator-=()",
319 return *gsl_vector_ptr(
m_vec,i);
325 return *gsl_vector_const_ptr(
m_vec,i);
333 iRC = gsl_vector_memcpy(this->
m_vec, src.
m_vec);
358 "GslVector::sizeLocal()",
359 "incompatible vec size");
376 "GslVector::sizeGlobal()",
377 "incompatible vec size");
391 return std::sqrt(this->
norm2Sq());
400 for (
unsigned int i = 0; i < size; ++i) {
401 result += fabs((*
this)[i]);
414 for (
unsigned int i = 0; i < size; ++i) {
415 aux = fabs((*
this)[i]);
416 if (aux > result) result = aux;
427 for (
unsigned int i = 0; i < size; ++i) {
428 result += (*this)[i];
438 for (
unsigned int i = 0; i < size; ++i) {
448 for (
unsigned int i = 0; i < this->
sizeLocal(); ++i) {
458 for (
unsigned int i = 0; i < this->
sizeLocal(); ++i) {
467 for (
unsigned int i = 0; i < this->
sizeLocal(); ++i) {
478 "GslVector::cwSetBeta()",
479 "incompatible alpha size");
483 "GslVector::cwSetBeta()",
484 "incompatible beta size");
486 double tmpSample = 0.;
487 for (
unsigned int i = 0; i < this->
sizeLocal(); ++i) {
493 <<
", alpha[i] = " << alpha[i]
494 <<
", beta[i] = " << beta[i]
495 <<
", sample = " << tmpSample
498 if ((alpha[i] == 1. ) &&
500 if (tmpSample == 1.) {
505 <<
", alpha[i] = " << alpha[i]
506 <<
", beta[i] = " << beta[i]
507 <<
", sample = " << tmpSample
511 std::cerr <<
"Hitting 'sample = 1' in GslVector::cwSetBeta()"
514 <<
", alpha[i] = " << alpha[i]
515 <<
", beta[i] = " << beta[i]
516 <<
", sample = " << tmpSample
520 }
while (tmpSample == 1.);
521 std::cerr <<
"Code was able to get 'sample != 1' in GslVector::cwSetBeta()"
524 <<
", alpha[i] = " << alpha[i]
525 <<
", beta[i] = " << beta[i]
526 <<
", sample = " << tmpSample
531 (*this)[i] = tmpSample;
541 "GslVector::cwSetGamma()",
542 "incompatible a size");
546 "GslVector::cwSetGamma()",
547 "incompatible b size");
549 for (
unsigned int i = 0; i < this->
sizeLocal(); ++i) {
560 "GslVector::cwSetInverseGamma()",
561 "incompatible alpha size");
565 "GslVector::cwSetInverseGamma()",
566 "incompatible beta size");
568 for (
unsigned int i = 0; i < this->
sizeLocal(); ++i) {
579 "GslVector::cwSetConcatenated(1)",
580 "incompatible vector sizes");
582 for (
unsigned int i = 0; i < v1.
sizeLocal(); ++i) {
586 for (
unsigned int i = 0; i < v2.
sizeLocal(); ++i) {
596 unsigned int cummulativeSize = 0;
597 for (
unsigned int i = 0; i < vecs.size(); ++i) {
599 for (
unsigned int j = 0; j < vecs[i]->sizeLocal(); ++j) {
600 (*this)[cummulativeSize+j] = tmpVec[j];
607 "GslVector::cwSetConcatenated(1)",
608 "incompatible vector sizes");
618 "GslVector::cwSet()",
619 "invalid initialPos");
623 "GslVector::cwSet()",
624 "invalid vec.sizeLocal()");
626 for (
unsigned int i = 0; i < vec.
sizeLocal(); ++i) {
627 (*this)[initialPos+i] = vec[i];
638 "GslVector::cwExtract()",
639 "invalid initialPos");
643 "GslVector::cwExtract()",
644 "invalid vec.sizeLocal()");
646 for (
unsigned int i = 0; i < vec.
sizeLocal(); ++i) {
647 vec[i] = (*this)[initialPos+i];
657 for (
unsigned int i = 0; i < size; ++i) {
658 (*this)[i] = 1./(*this)[i];
668 for (
unsigned int i = 0; i < size; ++i) {
669 (*this)[i] = sqrt((*
this)[i]);
677 unsigned int firstPositionToStoreDiff,
678 double valueForRemainderPosition,
685 "GslVector::matlabDiff()",
686 "invalid firstPositionToStoreDiff");
690 "GslVector::matlabDiff()",
691 "invalid size of outputVecs");
693 for (
unsigned int i = 0; i < (size-1); ++i) {
694 outputVec[firstPositionToStoreDiff+i] = (*this)[i+1]-(*this)[i];
696 if (firstPositionToStoreDiff == 0) {
697 outputVec[size-1] = valueForRemainderPosition;
700 outputVec[0] = valueForRemainderPosition;
714 "GslVector::matlabLinearInterpExtrap()",
715 "invalid 'x1' size");
719 "GslVector::matlabLinearInterpExtrap()",
720 "invalid 'x1' and 'y1' sizes");
724 "GslVector::matlabLinearInterpExtrap()",
725 "invalid 'x2' and 'this' sizes");
727 for (
unsigned int i = 1; i < x1Vec.
sizeLocal(); ++i) {
730 "GslVector::matlabLinearInterpExtrap()",
731 "invalid 'x1' values");
734 for (
unsigned int id2 = 0; id2 < x2Vec.
sizeLocal(); ++id2) {
735 double x2 = x2Vec[id2];
736 unsigned int id1 = 0;
738 for (id1 = 0; id1 < x1Vec.
sizeLocal(); ++id1) {
739 if (x2 <= x1Vec[id1]) {
744 bool makeLinearModel =
false;
749 if (x2 == x1Vec[id1]) {
750 (*this)[id2] = y1Vec[id1];
752 else if (x2 < x1Vec[0]) {
754 makeLinearModel =
true;
760 else if (found1 ==
true) {
762 makeLinearModel =
true;
770 makeLinearModel =
true;
777 if (makeLinearModel) {
778 double rate = (yb-ya)/(xb-xa);
779 (*this)[id2] = ya + (x2-xa)*rate;
791 gsl_sort_vector(
m_vec);
800 if (bcastComm.
MyPID() < 0)
return;
805 "GslVector::mpiBcast()",
809 double localNumNodes = 1.;
810 double totalNumNodes = 0.;
812 "GslVector::mpiBcast()",
813 "failed MPI.Allreduce() for numNodes");
816 "GslVector::mpiBcast()",
817 "inconsistent numNodes");
820 double localVectorSize = this->
sizeLocal();
821 double sumOfVectorSizes = 0.;
823 "GslVector::mpiBcast()",
824 "failed MPI.Allreduce() for vectorSize");
826 if ( ((
unsigned int) sumOfVectorSizes) != ((
unsigned int)(totalNumNodes*localVectorSize)) ) {
827 std::cerr <<
"rank " << bcastComm.
MyPID()
828 <<
": sumOfVectorSizes = " << sumOfVectorSizes
829 <<
", totalNumNodes = " << totalNumNodes
830 <<
", localVectorSize = " << localVectorSize
834 UQ_FATAL_TEST_MACRO(((
unsigned int) sumOfVectorSizes) != ((
unsigned int)(totalNumNodes*localVectorSize)),
836 "GslVector::mpiBcast()",
837 "inconsistent vectorSize");
840 std::vector<double> dataBuffer((
unsigned int) localVectorSize, 0.);
841 if (bcastComm.
MyPID() == srcRank) {
842 for (
unsigned int i = 0; i < dataBuffer.size(); ++i) {
843 dataBuffer[i] = (*this)[i];
848 "GslVector::mpiBcast()",
849 "failed MPI.Bcast()");
851 if (bcastComm.
MyPID() != srcRank) {
852 for (
unsigned int i = 0; i < dataBuffer.size(); ++i) {
853 (*this)[i] = dataBuffer[i];
864 if (opComm.
MyPID() < 0)
return;
869 "GslVector::mpiAllReduce()",
870 "different vector sizes");
872 for (
unsigned int i = 0; i < size; ++i) {
873 double srcValue = (*this)[i];
874 double resultValue = 0.;
876 "GslVector::mpiAllReduce()",
877 "failed MPI.Allreduce()");
878 resultVec[i] = resultValue;
888 if (opComm.
MyPID() < 0)
return;
892 "GslVector::mpiAllQuantile()",
898 "GslVector::mpiAllQuantile()",
899 "different vector sizes");
901 for (
unsigned int i = 0; i < size; ++i) {
902 double auxDouble = (int) (*
this)[i];
903 std::vector<double> vecOfDoubles(opComm.
NumProc(),0.);
905 "GslVector::mpiAllQuantile()",
906 "failed MPI.Gather()");
908 std::sort(vecOfDoubles.begin(), vecOfDoubles.end());
910 double result = vecOfDoubles[(
unsigned int)( probability*((
double)(vecOfDoubles.size()-1)) )];
913 "GslVector::mpiAllQuantile()",
914 "failed MPI.Bcast()");
916 resultVec[i] = result;
933 std::ostream::fmtflags curr_fmt = os.flags();
938 unsigned int savedPrecision = os.precision();
942 for (
unsigned int i = 0; i < size; ++i) {
943 os << std::scientific << (*this)[i]
948 for (
unsigned int i = 0; i < size; ++i) {
949 os << std::scientific << (*this)[i]
954 os.precision(savedPrecision);
960 for (
unsigned int i = 0; i < size; ++i) {
961 os << std::dec << (*this)[i]
966 for (
unsigned int i = 0; i < size; ++i) {
967 os << std::dec << (*this)[i]
984 const std::string& varNamePrefix,
985 const std::string& fileName,
986 const std::string& fileType,
987 const std::set<unsigned int>& allowedSubEnvIds)
const
991 "GslVector::subWriteContents()",
992 "unexpected subRank");
996 "GslVector::subWriteContents()",
997 "implemented just for sequential vectors for now");
1009 *filePtrSet.ofsVar << varNamePrefix <<
"_sub" <<
m_env.
subIdString() <<
" = [";
1015 *filePtrSet.ofsVar << *
this;
1020 *filePtrSet.ofsVar <<
"];\n";
1030 const std::string& fileName,
1031 const std::string& fileType,
1032 const std::set<unsigned int>& allowedSubEnvIds)
1036 "GslVector::subReadContents()",
1037 "unexpected subRank");
1041 "GslVector::subReadContents()",
1042 "implemented just for sequential vectors for now");
1052 unsigned int idOfMyFirstLine = 1;
1053 unsigned int idOfMyLastLine = this->
sizeLocal();
1054 unsigned int numParams = 1;
1058 std::string tmpString;
1061 *filePtrSet.ifsVar >> tmpString;
1065 *filePtrSet.ifsVar >> tmpString;
1069 "GslVector::subReadContents()",
1070 "string should be the '=' sign");
1073 *filePtrSet.ifsVar >> tmpString;
1075 unsigned int posInTmpString = 6;
1078 char nPositionsString[tmpString.size()-posInTmpString+1];
1079 unsigned int posInPositionsString = 0;
1083 "GslVector::subReadContents()",
1084 "symbol ',' not found in first line of file");
1085 nPositionsString[posInPositionsString++] = tmpString[posInTmpString++];
1086 }
while (tmpString[posInTmpString] !=
',');
1087 nPositionsString[posInPositionsString] =
'\0';
1091 char nParamsString[tmpString.size()-posInTmpString+1];
1092 unsigned int posInParamsString = 0;
1096 "GslVector::subReadContents()",
1097 "symbol ')' not found in first line of file");
1098 nParamsString[posInParamsString++] = tmpString[posInTmpString++];
1099 }
while (tmpString[posInTmpString] !=
')');
1100 nParamsString[posInParamsString] =
'\0';
1103 unsigned int sizeOfVecInFile = (
unsigned int) strtod(nPositionsString,NULL);
1104 unsigned int numParamsInFile = (
unsigned int) strtod(nParamsString, NULL);
1108 <<
", sizeOfVecInFile = " << sizeOfVecInFile
1109 <<
", numParamsInFile = " << numParamsInFile
1110 <<
", this->sizeLocal() = " << this->
sizeLocal()
1117 "GslVector::subReadContents()",
1118 "size of vec in file is not big enough");
1123 "GslVector::subReadContents()",
1124 "number of parameters of vec in file is different than number of parameters in this vec object");
1127 unsigned int maxCharsPerLine = 64*numParams;
1129 unsigned int lineId = 0;
1130 while (lineId < idOfMyFirstLine) {
1131 filePtrSet.ifsVar->ignore(maxCharsPerLine,
'\n');
1137 <<
": beginning to read input actual data"
1144 *filePtrSet.ifsVar >> tmpString;
1148 *filePtrSet.ifsVar >> tmpString;
1152 "GslVector::subReadContents()",
1153 "in core 0, string should be the '=' sign");
1156 std::streampos tmpPos = filePtrSet.ifsVar->tellg();
1157 filePtrSet.ifsVar->seekg(tmpPos+(std::streampos)2);
1161 <<
": beginning to read lines with numbers only"
1162 <<
", lineId = " << lineId
1163 <<
", idOfMyFirstLine = " << idOfMyFirstLine
1164 <<
", idOfMyLastLine = " << idOfMyLastLine
1168 while (lineId <= idOfMyLastLine) {
1169 *filePtrSet.ifsVar >> (*this)[lineId - idOfMyFirstLine];
1190 "GslVector::atLeastOneComponentSmallerThan()",
1191 "vectors have different sizes");
1193 bool result =
false;
1196 while ((i < size) && (result ==
false)) {
1197 result = ( (*this)[i] < rhs[i] );
1209 "GslVector::atLeastOneComponentBiggerThan()",
1210 "vectors have different sizes");
1212 bool result =
false;
1215 while ((i < size) && (result ==
false)) {
1216 result = ( (*this)[i] > rhs[i] );
1228 "GslVector::atLeastOneComponentSmallerOrEqualThan()",
1229 "vectors have different sizes");
1231 bool result =
false;
1234 while ((i < size) && (result ==
false)) {
1235 result = ( (*this)[i] <= rhs[i] );
1247 "GslVector::atLeastOneComponentBiggerOrEqualThan()",
1248 "vectors have different sizes");
1250 bool result =
false;
1253 while ((i < size) && (result ==
false)) {
1254 result = ( (*this)[i] >= rhs[i] );
1264 return gsl_vector_max(
m_vec );
1270 return gsl_vector_min(
m_vec );
1276 return gsl_vector_max_index(
m_vec );
1282 return gsl_vector_min_index(
m_vec );
1308 unsigned int size = abs_of_this_vec.
sizeLocal();
1310 for(
unsigned int i = 0; i < size; ++i )
1312 abs_of_this_vec[i] = std::fabs( (*
this)[i] );
1315 return abs_of_this_vec;
1367 "different sizes of x and y");
1370 for (
unsigned int i = 0; i < size1; ++i) {
1371 result += x[i]*y[i];
1403 "different sizes of lhs and rhs");
1405 for (
unsigned int i = 0; i < size1; ++i) {
1406 if (lhs[i] != rhs[i]) {
int NumGlobalElements() const
Returns the total number of elements across all processors.
const std::string & subIdString() const
Access to the attribute m_subIdString; which stores the string for the sub-environment, and it will be used, for instance, to create the output files for each sub-environment.
bool openInputFile(const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds, FilePtrSetStruct &filePtrSet) const
Opens an input file.
unsigned int numOfProcsForStorage() const
int NumProc() const
Returns total number of processes.
double normInf() const
Returns the infinity-norm (maximum norm) of the vector.
void cwSetInverseGamma(const GslVector &alpha, const GslVector &beta)
This function returns a random variate from the inverse gamma distribution with vector parameters alp...
int subRank() const
Access function for sub-rank.
bool operator==(const GslVector &lhs, const GslVector &rhs)
void getMaxValueAndIndex(double &value, int &index)
This function returns maximum value in the vector this and its the index.
GslMatrix operator*(double a, const GslMatrix &mat)
virtual double gaussianSample(double stdDev) const =0
Samples a value from a Gaussian distribution with standard deviation given by stdDev.
const RngBase * rngObject() const
Access to the RNG object.
GslMatrix operator-(const GslMatrix &m1, const GslMatrix &m2)
GslVector & operator-=(const GslVector &rhs)
Stores in this the coordinate-wise subtraction of this by rhs.
GslMatrix operator+(const GslMatrix &m1, const GslMatrix &m2)
const Map & m_map
Mapping variable.
Struct for handling data input and output from files.
int worldRank() const
Returns the process world rank.
virtual double gammaSample(double a, double b) const =0
Samples a value from a Gamma distribution.
GslVector abs() const
This function returns absolute value of elements in this.
void Bcast(void *buffer, int count, RawType_MPI_Datatype datatype, int root, const char *whereMsg, const char *whatMsg) const
Broadcast values from the root process to the slave processes.
int getMinValueIndex() const
This function returns the index of the minimum value in the vector this.
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
#define RawValue_MPI_DOUBLE
bool atLeastOneComponentSmallerOrEqualThan(const GslVector &rhs) const
This function returns true if at least one component of this is smaller than or equal to the respecti...
double norm2Sq() const
Returns the 2-norm squared of this vector.
void Gather(void *sendbuf, int sendcnt, RawType_MPI_Datatype sendtype, void *recvbuf, int recvcount, RawType_MPI_Datatype recvtype, int root, const char *whereMsg, const char *whatMsg) const
Gather values from each process to collect on all processes.
bool getPrintHorizontally() const
Checks if vector is printed horizontally.
std::ostream & operator<<(std::ostream &os, const BaseEnvironment &obj)
void setPrintHorizontally(bool value) const
Determines whether vector should be printed horizontally.
#define UQ_FATAL_RC_MACRO(macroIRc, givenRank, where, what)
int NumMyElements() const
Returns the number of elements owned by the calling processor.
void cwSet(double value)
Component-wise sets all values to this with value.
double getMaxValue() const
Returns the maximum value in the vector this.
void Barrier() const
Pause every process in *this communicator until all the processes reach this point.
void matlabDiff(unsigned int firstPositionToStoreDiff, double valueForRemainderPosition, GslVector &outputVec) const
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
void cwSetGamma(const GslVector &a, const GslVector &b)
This function returns a random variate from the gamma distribution with vector parameters a and b...
void mpiAllReduce(RawType_MPI_Op mpiOperation, const MpiComm &opComm, GslVector &resultVec) const
void mpiBcast(int srcRank, const MpiComm &bcastComm)
A class for partitioning vectors and matrices.
std::ofstream * ofsVar
Provides a stream interface to write data to files.
unsigned int sizeLocal() const
Returns the length of this vector.
GslVector()
Default Constructor.
bool m_printScientific
Flag for either or not print this matrix in scientific notation.
GslVector & operator/=(double a)
Stores in this the coordinate-wise division of this by a.
void sort()
This function sorts the elements of the vector this in ascending numerical order. ...
double scalarProduct(const GslVector &x, const GslVector &y)
GslVector operator/(double a, const GslVector &x)
double norm2() const
Returns the 2-norm (Euclidean norm) of the vector.
bool getPrintScientific() const
Checks if the vector should be printed in Scientific Notation.
#define UQ_FATAL_TEST_MACRO(test, givenRank, where, what)
double & operator[](unsigned int i)
Element access method (non-const).
void Allreduce(void *sendbuf, void *recvbuf, int count, RawType_MPI_Datatype datatype, RawType_MPI_Op op, const char *whereMsg, const char *whatMsg) const
Combines values from all processes and distributes the result back to all processes.
const BaseEnvironment & m_env
Environment variable.
void closeFile(FilePtrSetStruct &filePtrSet, const std::string &fileType) const
Closes the file.
Class for vector operations using GSL library.
int MyPID() const
Return my process ID.
double getMinValue() const
Returns minimum 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
void cwSetBeta(const GslVector &alpha, const GslVector &beta)
This function returns a random variate from the beta distribution, with vector parameters alpha and b...
gsl_vector * m_vec
GSL vector.
The QUESO MPI Communicator Class.
void copy(const GslVector &src)
This function copies the elements of the vector src into this.
virtual void copy(const Vector &src)
Copies vector src to this matrix.
int getMaxValueIndex() const
This function returns the index of the maximum value in the vector this.
int fullRank() const
Returns the process full rank.
void mpiAllQuantile(double probability, const MpiComm &opComm, GslVector &resultVec) const
double norm1() const
Returns the 1-norm of the vector.
GslVector & operator=(const GslVector &rhs)
Copies values from vector rhs to this.
void cwSetGaussian(double mean, double stdDev)
This function sets component-wise Gaussian random variates, with mean mean and standard deviation std...
void print(std::ostream &os) const
Print method. Defines the behavior of the std::ostream << operator inherited from the Object class...
void cwSetConcatenated(const GslVector &v1, const GslVector &v2)
This function concatenates GslVector v1 and GslVector v2 into this.
void matlabLinearInterpExtrap(const GslVector &x1Vec, const GslVector &y1Vec, const GslVector &x2Vec)
void subReadContents(const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds)
void cwSetUniform(const GslVector &aVec, const GslVector &bVec)
This function sets component-wise a number uniformly distributed in the range of elements of [aVec...
void setPrintScientific(bool value) const
Determines whether vector should be printed in Scientific Notation.
unsigned int displayVerbosity() const
const BaseEnvironment & env() const
bool atLeastOneComponentBiggerOrEqualThan(const GslVector &rhs) const
This function returns true if at least one component of this is bigger than or equal to the respectiv...
virtual double uniformSample() const =0
Samples a value from a uniform distribution.
void cwInvert()
This function inverts component-wise the element values of this.
bool atLeastOneComponentSmallerThan(const GslVector &rhs) const
This function returns true if at least one component of this is smaller than the respective component...
unsigned int sizeGlobal() const
Returns the global length of this vector.
double sumOfComponents() const
Returns the sum of the components of the vector.
void getMinValueAndIndex(double &value, int &index)
This function returns minimum value in the vector this and its the index.
bool openOutputFile(const std::string &fileName, const std::string &fileType, const std::set< unsigned int > &allowedSubEnvIds, bool writeOver, FilePtrSetStruct &filePtrSet) const
Opens an output file for each sub-environment that was chosen to send data to the file...
GslVector & operator+=(const GslVector &rhs)
Stores in this the coordinate-wise addition of this and rhs.
bool m_printHorizontally
Flag for either or not print this matrix horizontally.
gsl_vector * data() const
void cwSqrt()
This function returns component-wise the square-root of this.
Class for vector operations (virtual).
void cwExtract(unsigned int initialPos, GslVector &vec) const
This function sets the values of this starting at position initialPos ans saves them in vector vec...
GslVector & operator*=(double a)
Stores in this the coordinate-wise multiplication of this and a.
virtual double betaSample(double alpha, double beta) const =0
Samples a value from a Beta distribution.
bool atLeastOneComponentBiggerThan(const GslVector &rhs) const
This function returns true if at least one component of this is bigger than the respective component ...