Exemplo n.º 1
0
  void InterpolationSurrogateBuilder<V,M>::partition_work()
  {
    // Convenience
    unsigned int n_values = this->get_default_data().n_values();
    unsigned int n_workers = this->get_default_data().get_paramDomain().env().numSubEnvironments();

    unsigned int n_jobs = n_values/n_workers;
    unsigned int n_leftover = this->get_default_data().n_values() % n_workers;

    /* If the number of values is evenly divisible over all workers,
       then everyone gets the same amount work */
    if( n_leftover  == 0 )
      {
        for(unsigned int n = 0; n < n_workers; n++)
          this->m_njobs[n] = n_jobs;
      }
    /* Otherwise, some workers get more work than others*/
    else
      {
        for(unsigned int n = 0; n < n_workers; n++)
          {
            if( n < n_leftover )
              this->m_njobs[n] = n_jobs+1;
            else
              this->m_njobs[n] = n_jobs;
          }
      }

    // Sanity check
    queso_assert_equal_to( (int)n_values, std::accumulate( m_njobs.begin(), m_njobs.end(), 0 ) );
  }
Exemplo n.º 2
0
void
GaussianJointPdf<V,M>::distributionVariance(M & covMatrix) const
{
  queso_assert_equal_to (covMatrix.numCols(), covMatrix.numRowsGlobal());

  if (m_diagonalCovMatrix) {
    covMatrix.zeroLower();
    covMatrix.zeroUpper();

    unsigned int n_comp = this->lawVarVector().sizeLocal();
    queso_assert_equal_to (n_comp, covMatrix.numCols());

    for (unsigned int i = 0; i < n_comp; ++i) {
      covMatrix(i,i) = this->lawVarVector()[i];
    }
  } else {
    covMatrix = *this->m_lawCovMatrix;
  }
}
 virtual void evaluate_model( const V & domainVector, std::vector<double>& values )
 { queso_assert_equal_to( domainVector.sizeGlobal(), 4);
   queso_assert_equal_to( values.size(), 2 );
   values[0] = four_d_fn_1(domainVector[0],domainVector[1],domainVector[2],domainVector[3]);
   values[1] = four_d_fn_2(domainVector[0],domainVector[1],domainVector[2],domainVector[3]);
 };