Expansions

class sumpy.expansion.ExpansionBase(kernel, order, use_rscale=None)[source]
with_kernel(kernel)[source]
__len__()[source]
get_coefficient_identifiers()[source]

Returns the identifiers of the coefficients that actually get stored.

coefficients_from_source(kernel, avec, bvec, rscale, sac=None)[source]

Form an expansion from a source point.

Parameters
  • avec – vector from source to center.

  • bvec – vector from center to target. Not usually necessary, except for line-Taylor expansion.

  • sac – a symbolic assignment collection where temporary expressions are stored.

Returns

a list of sympy expressions representing the coefficients of the expansion.

translate_from(src_expansion, src_coeff_exprs, src_rscale, dvec, tgt_rscale, sac=None)[source]
__eq__(other)[source]

Return self==value.

__ne__(other)[source]

Return self!=value.

class sumpy.expansion.LinearPDEBasedExpansionTermsWrangler(order, dim, knl, max_mi=None)[source]
__init__(order, dim, knl, max_mi=None)[source]
Parameters
  • order – order of the expansion

  • dim – number of dimensions

  • knl – kernel for the PDE

Expansion Factories

class sumpy.expansion.ExpansionFactoryBase[source]

An interface .. automethod:: get_local_expansion_class .. automethod:: get_multipole_expansion_class

class sumpy.expansion.DefaultExpansionFactory[source]

An implementation of ExpansionFactoryBase that gives the ‘best known’ expansion for each kernel.

class sumpy.expansion.VolumeTaylorExpansionFactory[source]

An implementation of ExpansionFactoryBase that uses Volume Taylor expansions for each kernel.

Differential Operators

Differential operator interface

class sumpy.expansion.diff_op.LinearPDESystemOperator(dim, *eqs)[source]

Represents a constant-coefficient linear differential operator of a vector-valued function with dim spatial variables. It is represented by a tuple of immutable dictionaries. The dictionary maps a DerivativeIdentifier to the coefficient. This object is immutable. Optionally supports a time variable as the last variable in the multi-index of the DerivativeIdentifier.

class sumpy.expansion.diff_op.DerivativeIdentifier(mi, vec_idx)
sumpy.expansion.diff_op.make_identity_diff_op(ninput, noutput=1, time_dependent=False)[source]

Returns the identity as a linear PDE system operator. if include_time is true, then the last dimension of the multi-index is time.

Parameters
  • ninput – number of spatial variables of the function

  • noutput – number of output values of function

  • time_dependent – include time as a dimension

sumpy.expansion.diff_op.as_scalar_pde(pde, vec_idx)[source]

Returns a scalar PDE that is satisfied by the vec_idx component of pde.

Parameters
  • pde – An instance of LinearPDESystemOperator

  • vec_idx – the index of the vector-valued function that we want as a scalar PDE

Local Expansions

class sumpy.expansion.local.LocalExpansionBase(kernel, order, use_rscale=None, use_preprocessing_for_m2l=False)[source]

Base class for local expansions.

kernel
order
use_rscale
use_preprocessing_for_m2l
m2l_translation_classes_dependent_data(src_expansion, src_rscale, dvec, tgt_rscale, sac) Tuple[Any][source]

Return an iterable of expressions that needs to be precomputed for multipole-to-local translations that depend only on the distance between the multipole center and the local center which is given as dvec.

Since there are only a finite number of different values for the distance between per level, these can be precomputed for the tree. In boxtree, these distances are referred to as translation classes.

m2l_translation_classes_dependent_ndata(src_expansion)[source]

Return the number of expressions returned by m2l_translation_classes_dependent_data(). This method exists because calculating the number of expressions using the above method might be costly and m2l_translation_classes_dependent_data() cannot be memoized due to it having side effects through the argument sac.

m2l_preprocess_multipole_exprs(src_expansion, src_coeff_exprs, sac, src_rscale)[source]

Return the preprocessed multipole expansion for an optimized M2L. Preprocessing happens once per source box before M2L translation is done.

When FFT is turned on, the input expressions are transformed into Fourier space. These expressions are used in a separate loopy kernel to avoid having to transform for each target and source box pair. When FFT is turned off, the expressions are equal to the multipole expansion coefficients with zeros added to make the M2L computation a circulant matvec.

m2l_preprocess_multipole_nexprs(src_expansion)[source]

Return the number of expressions returned by m2l_preprocess_multipole_exprs(). This method exists because calculating the number of expressions using the above method might be costly and it cannot be memoized due to it having side effects through the argument sac.

m2l_postprocess_local_exprs(src_expansion, m2l_result, src_rscale, tgt_rscale, sac)[source]

Return postprocessed local expansion for an optimized M2L. Postprocessing happens once per target box just after the M2L translation is done and before storing the expansion coefficients for the local expansion.

When FFT is turned on, the output expressions are transformed from Fourier space back to the original space.

m2l_postprocess_local_nexprs(src_expansion)[source]

Return the number of expressions given as input to m2l_postprocess_local_exprs(). This method exists because calculating the number of expressions using the above method might be costly and it cannot be memoized due to it having side effects through the argument sac.

translate_from(src_expansion, src_coeff_exprs, src_rscale, dvec, tgt_rscale, sac=None, m2l_translation_classes_dependent_data=None)[source]

Translate from a multipole or local expansion to a local expansion

Parameters
  • src_expansion – The source expansion to translate from.

  • src_coeff_exprs – An iterable of symbolic expressions representing the coefficients of the source expansion.

  • src_rscale – scaling factor for the source expansion.

  • dvec – symbolic expression for the distance between target and source centers.

  • tgt_rscale – scaling factor for the target expansion.

  • sac – An object of type sumpy.assignment_collection.SymbolicAssignmentCollection to collect common subexpressions or None.

  • m2l_translation_classes_dependent_data – An iterable of symbolic expressions representing the expressions returned by m2l_translation_classes_dependent_data().

class sumpy.expansion.local.VolumeTaylorLocalExpansion(kernel, order, use_rscale=None, use_preprocessing_for_m2l=False)[source]
class sumpy.expansion.local.H2DLocalExpansion(kernel, order, use_rscale=None, use_preprocessing_for_m2l=False)[source]
class sumpy.expansion.local.Y2DLocalExpansion(kernel, order, use_rscale=None, use_preprocessing_for_m2l=False)[source]
class sumpy.expansion.local.LineTaylorLocalExpansion(kernel, order, use_rscale=None, use_preprocessing_for_m2l=False)[source]

Multipole Expansions

class sumpy.expansion.multipole.VolumeTaylorMultipoleExpansion(kernel, order, use_rscale=None)[source]
class sumpy.expansion.multipole.H2DMultipoleExpansion(kernel, order, use_rscale=None)[source]
class sumpy.expansion.multipole.Y2DMultipoleExpansion(kernel, order, use_rscale=None)[source]