Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

negative coefficients alpha in Gaussian expansion #247

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading