Skip to content

Commit

Permalink
negative coefficients alpha in Gaussian expansion (#247)
Browse files Browse the repository at this point in the history
* negative coefficients alpha are possible now in Gausian expansion

* documentation
  • Loading branch information
edinvay authored Oct 21, 2024
1 parent f9e50ba commit e2a8eea
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
12 changes: 12 additions & 0 deletions docs/programmers_manual/ConvolutionOperator.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---------------------
ConvolutionOperator
---------------------

This is an introduction to the ConvolutionOperator class. We write a small overarching summary of the class where we define the
algorithm/equation/structure reasoning for having this class or where it fits with the rest of the code.

.. doxygenclass:: mrcpp::ConvolutionOperator
:members:
:protected-members:
:private-members:

1 change: 1 addition & 0 deletions docs/programmers_manual/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ TODO: maybe add some low level theory/figures/algorithms before showing classes,
complex_apply
HeatOperator
HeatKernel
ConvolutionOperator
2 changes: 1 addition & 1 deletion src/operators/ConvolutionOperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void ConvolutionOperator<D>::initialize(GaussExp<1> &kernel, double k_prec, doub
for (int i = 0; i < kernel.size(); i++) {
// Rescale Gaussian for D-dim application
auto *k_func = kernel.getFunc(i).copy();
k_func->setCoef(std::pow(k_func->getCoef(), 1.0/D));
k_func->setCoef( std::copysign( std::pow(std::abs(k_func->getCoef()), 1.0/D), k_func->getCoef() ) );

FunctionTree<1> k_tree(k_mra);
mrcpp::build_grid(k_tree, *k_func); // Generate empty grid to hold narrow Gaussian
Expand Down
30 changes: 30 additions & 0 deletions src/operators/ConvolutionOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,36 @@

namespace mrcpp {

/** @class ConvolutionOperator
*
* @brief Convolution defined by a Gaussian expansion
*
* @details Represents the operator
* \f[
* T = \sum_{m=1}^M
* \text{sign} (\alpha_m) \bigotimes \limits_{d = 1}^D T_d
* \left( \beta_m, \sqrt[D]{| \alpha_m |} \right)
* ,
* \f]
* where each
* \f$ T_d \left( \beta, \alpha \right) \f$
* is the convolution operator with one-dimensional Gaussian kernel
* \f$ k(x_d) = \alpha \exp \left( - \beta x_d^2 \right) \f$.
* Operator
* \f$ T \f$
* is obtained from the Gaussian expansion
* \f[
* \sum_{m=1}^M \alpha_m \exp \left( - \beta_m |x|^2 \right)
* \f]
* which is passed as a parameter to the first two constructors.
*
* @note Every \f$ T_d \left( \beta_m, \sqrt[D]{| \alpha_m |} \right) \f$ is the same
* operator associated with the one-dimensional variable \f$ x_d \f$ for \f$ d = 1, \ldots, D \f$.
*
* \todo: One may want to change the logic so that \f$ D \f$-root is evaluated on the previous step,
* namely, when \f$ \alpha_m, \beta_m \f$ are calculated.
*
*/
template <int D> class ConvolutionOperator : public MWOperator<D> {
public:
ConvolutionOperator(const MultiResolutionAnalysis<D> &mra, GaussExp<1> &kernel, double prec);
Expand Down

0 comments on commit e2a8eea

Please sign in to comment.