Example #1
0
typename ScalarTraits<BasisFunctionType>::RealType L2NormOfDifference(
    const GridFunction<BasisFunctionType, ResultType> &gridFunction,
    const Fiber::Function<ResultType> &refFunction,
    const Fiber::QuadratureStrategy<BasisFunctionType, ResultType,
                                    GeometryFactory> &quadStrategy,
    const EvaluationOptions &options) {
  // First, construct the evaluator.
  typedef Fiber::EvaluatorForIntegralOperators<ResultType> Evaluator;
  std::unique_ptr<Evaluator> evaluator =
      makeEvaluator(gridFunction, refFunction, quadStrategy, options);

  typedef typename Fiber::ScalarTraits<BasisFunctionType>::RealType
  MagnitudeType;
  typedef MagnitudeType CoordinateType;
  arma::Mat<CoordinateType> evaluationPoints(1, 1);
  evaluationPoints(0, 0) = 0.;
  arma::Mat<ResultType> resultMatrix;
  evaluator->evaluate(Evaluator::FAR_FIELD, evaluationPoints, resultMatrix);

  ResultType result = resultMatrix(0, 0);
  if (fabs(imagPart(result)) >
      1000. * std::numeric_limits<MagnitudeType>::epsilon())
    std::cout << "Warning: squared L2 norm has non-negligible imaginary part: "
              << imagPart(result) << std::endl;
  return sqrt(realPart(result));
}
Example #2
0
void GetRealPartOfDiagonal
( const DistMatrix<T,U,V>& A, ElementalMatrix<Base<T>>& d, Int offset )
{ 
    DEBUG_ONLY(CSE cse("GetRealPartOfDiagonal"))
    function<Base<T>(T)> realPart
    ( []( T alpha ) { return RealPart(alpha); } );
    GetMappedDiagonal( A, d, realPart, offset );
}
Example #3
0
void GetRealPartOfDiagonal
( const DistMatrix<T,U,V>& A, AbstractDistMatrix<Base<T>>& d, Int offset )
{ 
    DEBUG_ONLY(CallStackEntry cse("GetRealPartOfDiagonal"))
    std::function<Base<T>(T)> realPart
    ( []( T alpha ) { return RealPart(alpha); } );
    GetMappedDiagonal( A, d, realPart, offset );
}
 CoordinateType estimateRelativeScale(CoordinateType distance) const {
   // This function is called rarely, invoking exp() here does little harm.
   return exp(-realPart(m_waveNumber) * distance);
 }
 CoordinateType estimateRelativeScale(CoordinateType distance) const {
     return exp(-realPart(m_waveNumber) * distance);
 }
Example #6
0
typename RT::RealElementType& getRealPart() { return realPart(mValue); }