Feature #3328

Implement numerical integration over vectors of functions

Added by Knödlseder Jürgen over 3 years ago. Updated over 3 years ago.

Status:ClosedStart date:09/03/2020
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:2.0.0
Duration:

Description

To improve the efficiency of the computations it should be possible to apply numerical integration to vectors of functions, returning hence the a vector of integrals in a single method call. This allows for example to integrate in one shot a function and its derivatives.

For this purpose a new class

class GFunctions {
public:

    // Constructors and destructors
    GFunction(void);
    GFunction(const GFunction& function);
    virtual ~GFunction(void);

    // Operators
    GFunction& operator=(const GFunction& function);

    // Methods
    virtual GVector eval(const double& x) = 0;
}
needs to be introduced which an eval() method that returns a vector of values for a given argument x.

Methods

explicit GIntegral(GFunctions* kernel);
void              kernel(GFunctions* kernel);
const GFunctions* kernel(void) const;
GVector           trapzd(const double& a, const double& b, const int& n, GVector result);
GVector           romberg_vector(const double& a, const double& b, const int& order);
need to be added to the GIntegral class to support these vectors.


Recurrence

No recurrence.


Related issues

Related to GammaLib - Action #3203: Implement spatial IRF integration methods that return IRF... Closed 04/11/2020

History

#1 Updated by Knödlseder Jürgen over 3 years ago

  • Related to Action #3203: Implement spatial IRF integration methods that return IRF values for all events added

#2 Updated by Knödlseder Jürgen over 3 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

I implemented the GFunctions class and added a dedicated unit test.

#3 Updated by Knödlseder Jürgen over 3 years ago

  • % Done changed from 10 to 90

I replaced GVector by GNdarray to have a more general definition of a set of functions in GFunctions.

For integration of a set of functions I implemented the GIntegrals class. Only the GIntegrals::romberg methods were implemented since the other integration methods are actually nowhere used. They can be added later if really needed.

#4 Updated by Knödlseder Jürgen over 3 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

Merged into devel.

Also available in: Atom PDF