25 #include <queso/Defines.h> 
   27 #ifdef QUESO_HAS_TRILINOS 
   29 #include <queso/TeuchosVector.h> 
   37 TeuchosVector::TeuchosVector(
const BaseEnvironment& env, 
const Map& map)
 
   41   m_vec.size(map.NumGlobalElements());
 
   59 TeuchosVector::TeuchosVector(
const BaseEnvironment& env, 
const Map& map, 
double value)
 
   63   m_vec.size(map.NumGlobalElements());
 
   76 TeuchosVector::TeuchosVector(
const BaseEnvironment& env, 
double d1, 
double d2, 
const Map& map)
 
   80   m_vec.size(map.NumGlobalElements());
 
   88   for (
int i = 0; i < m_vec.length(); ++i) {
 
   89     double alpha = (double) i / ((
double) m_vec.length() - 1.);
 
   90     (*this)[i] = (1.-alpha)*d1 + alpha*d2;
 
   97 TeuchosVector::TeuchosVector(
const TeuchosVector& v, 
double d1, 
double d2)
 
   99   Vector(v.env(),v.map())
 
  101   m_vec.size(v.sizeLocal());
 
  109   for ( 
int i = 0; i < m_vec.length(); ++i) {
 
  110     double alpha = (double) i / ((
double) m_vec.length() - 1.);
 
  111     (*this)[i] = (1.-alpha)*d1 + alpha*d2;
 
  118 TeuchosVector::TeuchosVector(
const TeuchosVector& v)  
 
  120   Vector(v.env(),v.map())
 
  122    m_vec.size(v.sizeLocal());
 
  136 TeuchosVector::~TeuchosVector()
 
  143 TeuchosVector& TeuchosVector::operator=(
double a)
 
  150 TeuchosVector& TeuchosVector::operator=(
const TeuchosVector& rhs)
 
  152   unsigned int size1 = m_vec.length();
 
  153   unsigned int size2 = rhs.sizeLocal();
 
  158     for (
unsigned int i=0;i<size1;i++){
 
  167 TeuchosVector& TeuchosVector::operator*=(
double a)
 
  174 TeuchosVector& TeuchosVector::operator/=(
double a)
 
  181 TeuchosVector& TeuchosVector::operator*=(
const TeuchosVector& rhs)
 
  183   unsigned int size1 = this->sizeLocal();
 
  184   unsigned int size2 = rhs.sizeLocal();
 
  187     for (
unsigned int i = 0; i < size1; ++i) {
 
  188       (*this)[i] *= rhs[i];
 
  195 TeuchosVector& TeuchosVector::operator/=(
const TeuchosVector& rhs)
 
  197   unsigned int size1 = this->sizeLocal();
 
  198   unsigned int size2 = rhs.sizeLocal();
 
  202     for (
unsigned int i = 0; i < size1; ++i) {
 
  203       (*this)[i] /= rhs[i];
 
  210 TeuchosVector& TeuchosVector::operator+=(
const TeuchosVector& rhs)
 
  212   unsigned int size1 = this->sizeLocal();
 
  213   unsigned int size2 = rhs.sizeLocal();
 
  218     for (
unsigned int i = 0; i < size1; ++i) {
 
  219       (*this)[i] += rhs[i];
 
  226 TeuchosVector& TeuchosVector::operator-=(
const TeuchosVector& rhs)
 
  228   unsigned int size1 = this->sizeLocal();
 
  229   unsigned int size2 = rhs.sizeLocal();
 
  234     for (
unsigned int i = 0; i < size1; ++i) {
 
  235       (*this)[i] -= rhs[i];
 
  245 double& TeuchosVector::operator[](
unsigned int i)
 
  251 const double& TeuchosVector::operator[](
unsigned int i)
 const 
  258 unsigned int TeuchosVector::sizeLocal()
 const 
  262   return m_vec.length();
 
  266 unsigned int TeuchosVector::sizeGlobal()
 const 
  269   return m_vec.length();
 
  275 TeuchosVector::values()
 
  277   return  m_vec.values();
 
  282 double TeuchosVector::getMaxValue( ) const  
 
  284   const unsigned int size = this->sizeLocal();
 
  285   std::vector<double> aux;
 
  287   for (
unsigned int i=0; i<size; i++ ) {
 
  288     aux.push_back((*
this)[i]) ;
 
  291   return *max_element (aux.begin(),aux.end());
 
  295 double TeuchosVector::getMinValue( ) const 
 
  297    const unsigned int size = this->sizeLocal();
 
  298    std::vector<double> aux;
 
  300   for (
unsigned int i=0; i<size; i++ ) {
 
  301     aux.push_back((*
this)[i]) ;
 
  304  return *min_element (aux.begin(),aux.end());
 
  309 int TeuchosVector::getMaxValueIndex( ) const   
 
  311   const unsigned int size = this->sizeLocal();
 
  312   std::vector<double> vect;
 
  314   for (
unsigned int i=0; i<size; i++ ) {
 
  315     vect.push_back((*
this)[i]) ;
 
  317   std::vector<double>::iterator iter_max = max_element(vect.begin(), vect.end());
 
  318   return distance(vect.begin(), iter_max);
 
  322 int TeuchosVector::getMinValueIndex( ) const 
 
  324   const unsigned int size = this->sizeLocal();
 
  325   std::vector<double> vect;
 
  327   for (
unsigned int i=0; i<size; i++ ) {
 
  328     vect.push_back((*
this)[i]) ;
 
  330   std::vector<double>::iterator iter_min = min_element(vect.begin(), vect.end());
 
  331   return distance(vect.begin(), iter_min);
 
  335 void TeuchosVector::getMaxValueAndIndex( 
double& max_value, 
int& max_value_index ) 
 
  337   const unsigned int size = this->sizeLocal();
 
  338   std::vector<double> vect;
 
  340   for (
unsigned int i=0; i<size; i++ ) {
 
  341     vect.push_back((*
this)[i]) ;
 
  343   std::vector<double>::iterator iter_max = max_element(vect.begin(), vect.end());
 
  345   max_value = *iter_max;
 
  346   max_value_index =  distance(vect.begin(), iter_max);
 
  352 void TeuchosVector::getMinValueAndIndex( 
double& min_value, 
int& min_value_index ) 
 
  354   const unsigned int size = this->sizeLocal();
 
  355   std::vector<double> vect;
 
  357   for (
unsigned int i=0; i<size; i++ ) {
 
  358     vect.push_back((*
this)[i]) ;
 
  360   std::vector<double>::iterator iter_min = min_element(vect.begin(), vect.end());
 
  362   min_value = *iter_min;
 
  363   min_value_index = distance(vect.begin(), iter_min);
 
  370 double TeuchosVector::norm2Sq()
 const 
  372  return (m_vec).dot(m_vec );
 
  376 double TeuchosVector::norm2()
 const 
  378   return std::sqrt(this->norm2Sq());
 
  382 double TeuchosVector::norm1()
 const 
  386   unsigned int size = this->sizeLocal();
 
  387   for (
unsigned int i = 0; i < size; ++i) {
 
  388     result += fabs((*
this)[i]);
 
  395 double TeuchosVector::normInf()
 const 
  399   unsigned int size = this->sizeLocal();
 
  401   for (
unsigned int i = 0; i < size; ++i) {
 
  402     aux = fabs((*
this)[i]);
 
  403     if (aux > result) result = aux;
 
  412 TeuchosVector::atLeastOneComponentSmallerThan(
const TeuchosVector& rhs)
 const 
  418   unsigned int size = this->sizeLocal();
 
  419   while ((i < size) && (result == 
false)) {
 
  420     result = ( (*this)[i] < rhs[i] );
 
  429 TeuchosVector::atLeastOneComponentBiggerThan(
const TeuchosVector& rhs)
 const 
  435   unsigned int size = this->sizeLocal();
 
  436   while ((i < size) && (result == 
false)) {
 
  437     result = ( (*this)[i] > rhs[i] );
 
  446 TeuchosVector::atLeastOneComponentSmallerOrEqualThan(
const TeuchosVector& rhs)
 const 
  452   unsigned int size = this->sizeLocal();
 
  453   while ((i < size) && (result == 
false)) {
 
  454     result = ( (*this)[i] <= rhs[i] ); 
 
  463 TeuchosVector::atLeastOneComponentBiggerOrEqualThan(
const TeuchosVector& rhs)
 const 
  469   unsigned int size = this->sizeLocal();
 
  470   while ((i < size) && (result == 
false)) {
 
  471     result = ( (*this)[i] >= rhs[i] ); 
 
  481 void TeuchosVector::cwSet(
double value)
 
  489 void TeuchosVector::cwSet(
unsigned int initialPos, 
const TeuchosVector& vec)
 
  495   for (
unsigned int i = 0; i < vec.sizeLocal(); ++i) {
 
  496     (*this)[initialPos+i] = vec[i];
 
  505 void TeuchosVector::cwExtract(
unsigned int initialPos, TeuchosVector& vec)
 const 
  511   for (
unsigned int i = 0; i < vec.sizeLocal(); ++i) {
 
  512     vec[i] = (*this)[initialPos+i];
 
  519 void TeuchosVector::cwInvert()
 
  521   unsigned int size = this->sizeLocal();
 
  522   for (
unsigned int i = 0; i < size; ++i) {
 
  523     (*this)[i] = 1./(*this)[i];
 
  530 void TeuchosVector::cwSqrt()
 
  532   unsigned int size = this->sizeLocal();
 
  533   for (
unsigned int i = 0; i < size; ++i) {
 
  534     (*this)[i] = sqrt((*
this)[i]);
 
  542 TeuchosVector::cwSetConcatenated(
const TeuchosVector& v1, 
const TeuchosVector& v2)
 
  554   for (
unsigned int i = 0; i < v1.sizeLocal(); ++i) {
 
  558   for (
unsigned int i = 0; i < v2.sizeLocal(); ++i) {
 
  559     (*this)[v1.sizeLocal()+i] = v2[i];
 
  567 void TeuchosVector::cwSetGaussian(
double mean, 
double stdDev)
 
  569   for (
unsigned int i = 0; i < this->sizeLocal(); ++i) {
 
  570         (*this)[i] = mean + m_env.rngObject()->gaussianSample(stdDev);
 
  577 void TeuchosVector::cwSetGaussian(
const TeuchosVector& meanVec, 
const TeuchosVector& stdDevVec)
 
  579   for (
unsigned int i = 0; i < this->sizeLocal(); ++i) {
 
  580     (*this)[i] = meanVec[i] + m_env.rngObject()->gaussianSample(stdDevVec[i]);
 
  589  void TeuchosVector::cwSetUniform(
const TeuchosVector& aVec, 
const TeuchosVector& bVec)
 
  591   for (
unsigned int i = 0; i < this->sizeLocal(); ++i) {
 
  592     (*this)[i] = aVec[i] + (bVec[i]-aVec[i])*m_env.rngObject()->uniformSample();
 
  600 void TeuchosVector::cwSetBeta(
const TeuchosVector& alpha, 
const TeuchosVector& beta)
 
  606   for (
unsigned int i = 0; i < this->sizeLocal(); ++i)
 
  608     (*this)[i] = m_env.rngObject()->betaSample(alpha[i],beta[i]);
 
  610     if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 99))
 
  612       *m_env.subDisplayFile() << 
"In TeuchosVector::cwSetBeta()" 
  613                               << 
": fullRank "   << m_env.fullRank()
 
  615                               << 
", alpha[i] = " << alpha[i]
 
  616                               << 
", beta[i] = "  << beta[i]
 
  617                               << 
", sample = "   << (*this)[i]
 
  626 void TeuchosVector::cwSetGamma(
const TeuchosVector& aVec, 
const TeuchosVector& bVec)
 
  632   for (
unsigned int i = 0; i < this->sizeLocal(); ++i) {
 
  633     (*this)[i] = m_env.rngObject()->gammaSample(aVec[i],bVec[i]);
 
  642 void TeuchosVector::cwSetInverseGamma(
const TeuchosVector& alpha, 
const TeuchosVector& beta)
 
  648   for (
unsigned int i = 0; i < this->sizeLocal(); ++i) {
 
  649     (*this)[i] = 1./m_env.rngObject()->gammaSample(alpha[i],1./beta[i]);
 
  659 TeuchosVector::abs()
 const 
  661   TeuchosVector abs_of_this_vec( *
this );
 
  663   unsigned int size = abs_of_this_vec.sizeLocal();
 
  665   for( 
unsigned int i = 0; i < size; ++i )
 
  667       abs_of_this_vec[i] = std::fabs( (*
this)[i] );
 
  670   return abs_of_this_vec;
 
  676 TeuchosVector::copy_to_std_vector(std::vector<double>& vec)
 
  678   unsigned int size = this->sizeLocal();
 
  681   for (
unsigned int i = 0; i < size; ++i)
 
  689 TeuchosVector::copy_from_std_vector(
const std::vector<double> vec)
 
  691   unsigned int size1 = vec.size(), size2= this->sizeLocal();
 
  695   for (
unsigned int i = 0; i < size1; ++i)
 
  702 void TeuchosVector::sort()
 
  704   std::vector<double> vec;
 
  706   (*this).copy_to_std_vector(vec);
 
  709   std::sort (vec.begin(), vec.end());
 
  711   (*this).copy_from_std_vector(vec);
 
  715 double TeuchosVector::sumOfComponents()
 const 
  718   unsigned int size = this->sizeLocal();
 
  719   for (
unsigned int i = 0; i < size; ++i) {
 
  720     result += (*this)[i];
 
  729 TeuchosVector::mpiBcast(
int srcRank, 
const MpiComm& bcastComm)
 
  732   if (bcastComm.MyPID() < 0) 
return;
 
  735   queso_require_msg(!((srcRank < 0) || (srcRank >= bcastComm.NumProc())), 
"invalud srcRank");
 
  738   double localNumNodes = 1.;
 
  739   double totalNumNodes = 0.;
 
  740   bcastComm.Allreduce<
double>(&localNumNodes, &totalNumNodes, (int) 1, 
RawValue_MPI_SUM,
 
  741                       "TeuchosVector::mpiBcast()",
 
  742                       "failed MPI.Allreduce() for numNodes");
 
  746   double localVectorSize  = this->sizeLocal();
 
  747   double sumOfVectorSizes = 0.;
 
  748   bcastComm.Allreduce<
double>(&localVectorSize, &sumOfVectorSizes, (int) 1, 
RawValue_MPI_SUM,
 
  749                       "TeuchosVector::mpiBcast()",
 
  750                       "failed MPI.Allreduce() for vectorSize");
 
  752   if ( ((
unsigned int) sumOfVectorSizes) != ((
unsigned int)(totalNumNodes*localVectorSize)) ) {
 
  753     std::cerr << 
"rank "                 << bcastComm.MyPID()
 
  754               << 
": sumOfVectorSizes = " << sumOfVectorSizes
 
  755               << 
", totalNumNodes = "    << totalNumNodes
 
  756               << 
", localVectorSize = "  << localVectorSize
 
  760   queso_require_equal_to_msg(((
unsigned int) sumOfVectorSizes), ((
unsigned int)(totalNumNodes*localVectorSize)), 
"inconsistent vectorSize");
 
  763   std::vector<double> dataBuffer((
unsigned int) localVectorSize, 0.);
 
  764   if (bcastComm.MyPID() == srcRank) {
 
  765     for (
unsigned int i = 0; i < dataBuffer.size(); ++i) {
 
  766       dataBuffer[i] = (*this)[i];
 
  770   bcastComm.Bcast((
void *) &dataBuffer[0], (
int) localVectorSize, 
RawValue_MPI_DOUBLE, srcRank,
 
  771                   "TeuchosVector::mpiBcast()",
 
  772                   "failed MPI.Bcast()");
 
  774   if (bcastComm.MyPID() != srcRank) {
 
  775     for (
unsigned int i = 0; i < dataBuffer.size(); ++i) {
 
  776       (*this)[i] = dataBuffer[i];
 
  786 TeuchosVector::mpiAllReduce(
RawType_MPI_Op mpiOperation, 
const MpiComm& opComm, TeuchosVector& resultVec)
 const 
  789   if (opComm.MyPID() < 0) 
return;
 
  791   unsigned int size = this->sizeLocal();
 
  794   for (
unsigned int i = 0; i < size; ++i) {
 
  795     double srcValue = (*this)[i];
 
  796     double resultValue = 0.;
 
  797     opComm.Allreduce<
double>(&srcValue, &resultValue, (int) 1, mpiOperation,
 
  798                      "TeuchosVector::mpiAllReduce()",
 
  799                      "failed MPI.Allreduce()");
 
  800     resultVec[i] = resultValue;
 
  809 TeuchosVector::mpiAllQuantile(
double probability, 
const MpiComm& opComm, TeuchosVector& resultVec)
 const 
  812   if (opComm.MyPID() < 0) 
return;
 
  816   unsigned int size = this->sizeLocal();
 
  819   for (
unsigned int i = 0; i < size; ++i) {
 
  820     double auxDouble = (int) (*
this)[i];
 
  821     std::vector<double> vecOfDoubles(opComm.NumProc(),0.);
 
  822     opComm.Gather<
double>(&auxDouble, 1, &vecOfDoubles[0], (int) 1, 0,
 
  823                   "TeuchosVector::mpiAllQuantile()",
 
  824                   "failed MPI.Gather()");
 
  826     std::sort(vecOfDoubles.begin(), vecOfDoubles.end());
 
  828     double result = vecOfDoubles[(
unsigned int)( probability*((
double)(vecOfDoubles.size()-1)) )];
 
  831                  "TeuchosVector::mpiAllQuantile()",
 
  832                  "failed MPI.Bcast()");
 
  834     resultVec[i] = result;
 
  843 TeuchosVector::matlabLinearInterpExtrap(
 
  844   const TeuchosVector& x1Vec,
 
  845   const TeuchosVector& y1Vec,
 
  846   const TeuchosVector& x2Vec)
 
  854   for (
unsigned int i = 1; i < x1Vec.sizeLocal(); ++i) { 
 
  858   for (
unsigned int id2 = 0; id2 < x2Vec.sizeLocal(); ++id2) {
 
  859     double x2 = x2Vec[id2];
 
  860     unsigned int id1 = 0;
 
  862     for (id1 = 0; id1 < x1Vec.sizeLocal(); ++id1) {
 
  863       if (x2 <= x1Vec[id1]) {
 
  868     bool makeLinearModel = 
false;
 
  873     if (x2 == x1Vec[id1]) {
 
  874       (*this)[id2] = y1Vec[id1];
 
  876     else if (x2 < x1Vec[0]) {
 
  878       makeLinearModel = 
true;
 
  884     else if (found1 == 
true) {
 
  886       makeLinearModel = 
true;
 
  894       makeLinearModel = 
true;
 
  895       xa = x1Vec[x1Vec.sizeLocal()-2];
 
  896       xb = x1Vec[x1Vec.sizeLocal()-1];
 
  897       ya = y1Vec[x1Vec.sizeLocal()-2];
 
  898       yb = y1Vec[x1Vec.sizeLocal()-1];
 
  901     if (makeLinearModel) {
 
  902       double rate = (yb-ya)/(xb-xa);
 
  903       (*this)[id2] = ya + (x2-xa)*rate;
 
  912 TeuchosVector::matlabDiff(
 
  913   unsigned int      firstPositionToStoreDiff,
 
  914   double            valueForRemainderPosition,
 
  915   TeuchosVector& outputVec)
 const 
  917   unsigned int size = this->sizeLocal();
 
  923   for (
unsigned int i = 0; i < (size-1); ++i) {
 
  924     outputVec[firstPositionToStoreDiff+i] = (*this)[i+1]-(*this)[i];
 
  926   if (firstPositionToStoreDiff == 0) {
 
  927     outputVec[size-1] = valueForRemainderPosition;
 
  930     outputVec[0] = valueForRemainderPosition;
 
  939 TeuchosVector::print(std::ostream& os)
 const 
  941   unsigned int size = this->sizeLocal();
 
  943   std::ostream::fmtflags curr_fmt = os.flags();
 
  945   if (m_printScientific) {
 
  946     unsigned int savedPrecision = os.precision();
 
  949     if (m_printHorizontally) {
 
  950       for (
unsigned int i = 0; i < size; ++i) {
 
  951         os << std::scientific << (*this)[i]
 
  956       for (
unsigned int i = 0; i < size; ++i) {
 
  957         os << std::scientific << (*this)[i]
 
  962     os.precision(savedPrecision);
 
  965     if (m_printHorizontally) {
 
  966       for (
unsigned int i = 0; i < size; ++i) {
 
  967         os << std::dec << (*this)[i]
 
  972       for (
unsigned int i = 0; i < size; ++i) {
 
  973         os << std::dec << (*this)[i]
 
  985 TeuchosVector::subReadContents(
 
  986   const std::string&            fileName,
 
  987   const std::string&            fileType,
 
  988   const std::set<unsigned int>& allowedSubEnvIds)
 
  994   FilePtrSetStruct filePtrSet;
 
  995   if (m_env.openInputFile(fileName,
 
  999     double subReadSize = this->sizeLocal();
 
 1002     unsigned int idOfMyFirstLine = 1;
 
 1003     unsigned int idOfMyLastLine = this->sizeLocal();
 
 1004     unsigned int numParams = 1; 
 
 1008     std::string tmpString;
 
 1011     *filePtrSet.ifsVar >> tmpString;
 
 1015     *filePtrSet.ifsVar >> tmpString;
 
 1020     *filePtrSet.ifsVar >> tmpString;
 
 1022     unsigned int posInTmpString = 6;
 
 1025     char nPositionsString[tmpString.size()-posInTmpString+1];
 
 1026     unsigned int posInPositionsString = 0;
 
 1029       nPositionsString[posInPositionsString++] = tmpString[posInTmpString++];
 
 1030     } 
while (tmpString[posInTmpString] != 
',');
 
 1031     nPositionsString[posInPositionsString] = 
'\0';
 
 1035     char nParamsString[tmpString.size()-posInTmpString+1];
 
 1036     unsigned int posInParamsString = 0;
 
 1039       nParamsString[posInParamsString++] = tmpString[posInTmpString++];
 
 1040     } 
while (tmpString[posInTmpString] != 
')');
 
 1041     nParamsString[posInParamsString] = 
'\0';
 
 1044     unsigned int sizeOfVecInFile = (
unsigned int) strtod(nPositionsString,NULL);
 
 1045     unsigned int numParamsInFile = (
unsigned int) strtod(nParamsString,   NULL);
 
 1046     if (m_env.subDisplayFile()) {
 
 1047       *m_env.subDisplayFile() << 
"In TeuchosVector::subReadContents()" 
 1048                               << 
": fullRank "            << m_env.fullRank()
 
 1049                               << 
", sizeOfVecInFile = "   << sizeOfVecInFile
 
 1050                               << 
", numParamsInFile = "   << numParamsInFile
 
 1051                               << 
", this->sizeLocal() = " << this->sizeLocal()
 
 1059     queso_require_equal_to_msg(numParamsInFile, numParams, 
"number of parameters of vec in file is different than number of parameters in this vec object");
 
 1062     unsigned int maxCharsPerLine = 64*numParams; 
 
 1064     unsigned int lineId = 0;
 
 1065     while (lineId < idOfMyFirstLine) {
 
 1066       filePtrSet.ifsVar->ignore(maxCharsPerLine,
'\n');
 
 1070     if (m_env.subDisplayFile()) {
 
 1071       *m_env.subDisplayFile() << 
"In TeuchosVector::subReadContents()" 
 1072                               << 
": beginning to read input actual data" 
 1079     *filePtrSet.ifsVar >> tmpString;
 
 1083     *filePtrSet.ifsVar >> tmpString;
 
 1088     std::streampos tmpPos = filePtrSet.ifsVar->tellg();
 
 1089     filePtrSet.ifsVar->seekg(tmpPos+(std::streampos)2);
 
 1091     if (m_env.subDisplayFile()) {
 
 1092       *m_env.subDisplayFile() << 
"In TeuchosVector::subReadContents()" 
 1093                               << 
": beginning to read lines with numbers only" 
 1094                               << 
", lineId = " << lineId
 
 1095                               << 
", idOfMyFirstLine = " << idOfMyFirstLine
 
 1096                               << 
", idOfMyLastLine = " << idOfMyLastLine
 
 1100     while (lineId <= idOfMyLastLine) {
 
 1101       *filePtrSet.ifsVar >> (*this)[lineId - idOfMyFirstLine];
 
 1105     m_env.closeFile(filePtrSet,fileType);
 
 1113 TeuchosVector::subWriteContents(
 
 1114   const std::string&            varNamePrefix,
 
 1115   const std::string&            fileName,
 
 1116   const std::string&            fileType,
 
 1117   const std::set<unsigned int>& allowedSubEnvIds)
 const 
 1123   FilePtrSetStruct filePtrSet;
 
 1124   if (m_env.openOutputFile(fileName,
 
 1129     *filePtrSet.ofsVar << varNamePrefix << 
"_sub" << m_env.subIdString() << 
" = zeros(" << this->sizeLocal()
 
 1133     *filePtrSet.ofsVar << varNamePrefix << 
"_sub" << m_env.subIdString() << 
" = [";
 
 1135     bool savedVectorPrintScientific   = this->getPrintScientific();
 
 1136     bool savedVectorPrintHorizontally = this->getPrintHorizontally();
 
 1137     this->setPrintScientific  (
true);
 
 1138     this->setPrintHorizontally(
false);
 
 1139     *filePtrSet.ofsVar << *
this;
 
 1141     this->setPrintHorizontally(savedVectorPrintHorizontally);
 
 1142     this->setPrintScientific  (savedVectorPrintScientific);
 
 1144     *filePtrSet.ofsVar << 
"];\n";
 
 1146     m_env.closeFile(filePtrSet,fileType);
 
 1162   unsigned int size1 = m_vec.length();
 
 1163   unsigned int size2 = rhs.sizeLocal();
 
 1166     for (
unsigned int i=0;i<size1;i++){
 
 1179 TeuchosVector 
operator/(
double a, 
const TeuchosVector& x)
 
 1181   TeuchosVector answer(x); 
 
 1188 TeuchosVector 
operator/(
const TeuchosVector& x, 
const TeuchosVector& y)
 
 1190   TeuchosVector answer(x);
 
 1196 TeuchosVector 
operator*(
double a, 
const TeuchosVector& x)
 
 1198   TeuchosVector answer(x);
 
 1204 TeuchosVector 
operator*(
const TeuchosVector& x, 
const TeuchosVector& y)
 
 1206   TeuchosVector answer(x);
 
 1212 double scalarProduct(
const TeuchosVector& x, 
const TeuchosVector& y)
 
 1214   unsigned int size1 = x.sizeLocal();
 
 1215   unsigned int size2 = y.sizeLocal();
 
 1219   for (
unsigned int i = 0; i < size1; ++i) {
 
 1220     result += x[i]*y[i];
 
 1227 TeuchosVector 
operator+(
const TeuchosVector& x, 
const TeuchosVector& y)
 
 1229   TeuchosVector answer(x);
 
 1235 TeuchosVector 
operator-(
const TeuchosVector& x, 
const TeuchosVector& y)
 
 1237   TeuchosVector answer(x);
 
 1244 operator== (
const TeuchosVector& lhs, 
const TeuchosVector& rhs)
 
 1247   unsigned int size1 = lhs.sizeLocal();
 
 1248   unsigned int size2 = rhs.sizeLocal();
 
 1252   for (
unsigned int i = 0; i < size1; ++i) {
 
 1253     if (lhs[i] != rhs[i]) {
 
 1264 operator<<(std::ostream& os, 
const TeuchosVector& obj)
 
 1275 #endif // ifdef QUESO_HAS_TRILINOS 
#define queso_require_greater_equal_msg(expr1, expr2, msg)
 
bool operator==(const GslVector &lhs, const GslVector &rhs)
 
std::ostream & operator<<(std::ostream &os, const BaseEnvironment &obj)
 
GslMatrix operator+(const GslMatrix &m1, const GslMatrix &m2)
 
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
 
#define queso_require_equal_to_msg(expr1, expr2, msg)
 
#define queso_require_less_msg(expr1, expr2, msg)
 
#define RawValue_MPI_DOUBLE
 
#define queso_require_greater_msg(expr1, expr2, msg)
 
GslMatrix operator-(const GslMatrix &m1, const GslMatrix &m2)
 
double scalarProduct(const GslVector &x, const GslVector &y)
 
#define queso_require_less_equal_msg(expr1, expr2, msg)
 
virtual void base_copy(const Vector &src)
Copies base data from vector src to this vector. 
 
#define queso_require_msg(asserted, msg)
 
GslMatrix operator*(double a, const GslMatrix &mat)
 
GslVector operator/(double a, const GslVector &x)