当前位置: 首页>>代码示例>>C++>>正文


C++ DataVector::getSize方法代码示例

本文整理汇总了C++中DataVector::getSize方法的典型用法代码示例。如果您正苦于以下问题:C++ DataVector::getSize方法的具体用法?C++ DataVector::getSize怎么用?C++ DataVector::getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataVector的用法示例。


在下文中一共展示了DataVector::getSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mult_transpose

  /**
   * Performs a transposed mass evaluation
   *
   * @param storage GridStorage object that contains the grid's points information
   * @param basis a reference to a class that implements a specific basis
   * @param source the coefficients of the grid points
   * @param x the d-dimensional vector with data points (row-wise)
   * @param result the result vector of the matrix vector multiplication
   */
  void mult_transpose(GridStorage* storage, BASIS& basis, DataVector& source,
                      DataMatrix& x, DataVector& result) {
    result.setAll(0.0);
    size_t source_size = source.getSize();

    #pragma omp parallel
    {
      DataVector privateResult(result.getSize());
      privateResult.setAll(0.0);

      DataVector line(x.getNcols());
      AlgorithmEvaluationTransposed<BASIS> AlgoEvalTrans(storage);

      privateResult.setAll(0.0);


      #pragma omp for schedule(static)

      for (size_t i = 0; i < source_size; i++) {
        x.getRow(i, line);

        AlgoEvalTrans(basis, line, source[i], privateResult);
      }

      #pragma omp critical
      {
        result.add(privateResult);
      }
    }
  }
开发者ID:ABAtanasov,项目名称:Sparse-Grids,代码行数:39,代码来源:AlgorithmMultipleEvaluation.hpp

示例2: parabola

SGPP::float_t parabola(DataVector& input) {
  SGPP::float_t result = 1.;

  for (size_t i = 0; i < input.getSize(); i++) {
    result *= input[i] * (1. - input[i]) * 4.;
  }

  return result;
}
开发者ID:ABAtanasov,项目名称:Sparse-Grids,代码行数:9,代码来源:test_hierarchisation.cpp

示例3: parabolaBoundary

SGPP::float_t parabolaBoundary(DataVector& input) {
  SGPP::float_t result = 1.;

  for (size_t i = 0; i < input.getSize(); i++) {
    result *= 0.25 * (input[i] - 0.7) * (input[i] - 0.7) + 2;
  }

  return result;
}
开发者ID:ABAtanasov,项目名称:Sparse-Grids,代码行数:9,代码来源:test_hierarchisation.cpp

示例4: doQuadrature

float_t OperationQuadraturePoly::doQuadrature(DataVector& alpha) {
  float_t res = 0;
  float_t tmpres = 0;
  GridIndex* gp;

  for (size_t i = 0; i < alpha.getSize(); i++) {
    gp = storage->get(i);
    tmpres = 1.;

    for (size_t d = 0; d < storage->dim(); d++) {
      tmpres *= base.getIntegral(gp->getLevel(d), gp->getIndex(d));
    }

    res += alpha[i] * tmpres;
  }

  return res;
}
开发者ID:ABAtanasov,项目名称:Sparse-Grids,代码行数:18,代码来源:OperationQuadraturePoly.cpp

示例5: mult

  /**
   * Performs a mass evaluation
   *
   * @param storage GridStorage object that contains the grid's points information
   * @param basis a reference to a class that implements a specific basis
   * @param source the coefficients of the grid points
   * @param x the d-dimensional vector with data points (row-wise)
   * @param result the result vector of the matrix vector multiplication
   */
  void mult(GridStorage* storage, BASIS& basis, DataVector& source, DataMatrix& x,
            DataVector& result) {
    result.setAll(0.0);
    size_t result_size = result.getSize();


    #pragma omp parallel
    {
      DataVector line(x.getNcols());
      AlgorithmEvaluation<BASIS> AlgoEval(storage);

      #pragma omp for schedule(static)

      for (size_t i = 0; i < result_size; i++) {
        x.getRow(i, line);

        result[i] = AlgoEval(basis, line, source);
      }
    }
  }
开发者ID:ABAtanasov,项目名称:Sparse-Grids,代码行数:29,代码来源:AlgorithmMultipleEvaluation.hpp


注:本文中的DataVector::getSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。