template<class Implementation, typename ... Tensors>
symtensor::MultipoleBase class

Multipole base-type for use with CRTP implementations.

Template parameters
Implementation CRTP subclass
Tensors sequence of tensors which make up the multipole. The order of the multipole is equivalent to the rank of the last tensor. The tensors should be provided in ascending order and without gaps.

In order to create a new type which behaves like a multipole, you can derive from this class so that operators will function correctly.

Derived classes

template<typename Implementation, typename Tuple>
class MultipoleBaseFromTuple
Helper class for defining a multipole based on an std::tuple of tensors.
template<typename Implementation, typename Tuple>
class MultipoleBaseFromTuple
Helper class for defining a multipole based on an std::tuple of tensors.

Public types

using Index = typename last_type_of_tuple<TensorTuple>::Index
Index type used to access tensor members Common to all contained tensors, as they should all have the same size.

Public static variables

static std::size_t Order constexpr
Multipole order, equivalent to the rank of the highest contained tensor.
static std::size_t NumTensors constexpr
Number of contained elements, all assumed to be tensors. A multipole may have a scalar component; this is treated a tensor of rank 0.

Constructors

MultipoleBase() defaulted explicit constexpr
Default constructor.
auto MultipoleBase(const Tensors&... types) -> ALWAYS_INLINE explicit constexpr
Constructor from a sequence of tensors.
template<indexable Vector>
auto MultipoleBase(const Vector& vector) -> ALWAYS_INLINE explicit constexpr
Constructor from a single vector.
template<indexable Vector>
static auto FromVector(const Vector& vector) -> ALWAYS_INLINE Implementation constexpr
Creator method from a single vector.

Member access

template<std::size_t R>
auto tensor() const -> const auto& constexpr
Tensor access by rank.
template<std::size_t R>
auto tensor() -> auto& constexpr
Tensor access by rank.
template<Index... Indices>
auto at() const -> const auto& constexpr
Direct access to members of tensors.
template<Index... Indices>
auto at() -> auto& constexpr
Direct access to members of tensors.

Multipole-scalar operations

template<typename T>
auto operator+=(const T& scalar) -> Implementation& constexpr
Element-wise addition of a scalar.
template<typename T>
auto operator-=(const T& scalar) -> Implementation& constexpr
Element-wise subtraction of a scalar.
template<typename T>
auto operator*=(const T& scalar) -> Implementation& constexpr
Element-wise multiplication by a scalar.
template<typename T>
auto operator/=(const T& scalar) -> Implementation& constexpr
Element-wise division by a scalar.
template<typename T>
auto operator+(const T& scalar) const -> Implementation constexpr
Element-wise addition of a scalar.
template<typename T>
auto operator-(const T& scalar) const -> Implementation constexpr
Element-wise subtraction of a scalar.
template<typename T>
auto operator*(const T& scalar) const -> Implementation constexpr
Element-wise multiplication by a scalar.
template<typename T>
auto operator/(const T& scalar) const -> Implementation constexpr
Element-wise division by a scalar.

Multipole-multipole operations

auto operator+=(const Implementation& other) -> Implementation& constexpr
Element-wise addition with another multipole.
auto operator-=(const Implementation& other) -> Implementation& constexpr
Element-wise subtraction by another multipole.
auto operator*=(const Implementation& other) -> Implementation& constexpr
Element-wise multiplication by another multipole.
auto operator/=(const Implementation& other) -> Implementation& constexpr
Element-wise division by another multipole.
auto operator+(const Implementation& other) const -> Implementation constexpr
Element-wise addition with another multipole.
auto operator-(const Implementation& other) const -> Implementation constexpr
Element-wise subtraction by another multipole.
auto operator*(const Implementation& other) const -> Implementation constexpr
Element-wise multiplication by another multipole.
auto operator/(const Implementation& other) const -> Implementation constexpr
Element-wise division by another multipole.

Comparison operators

auto operator==(const Self& other) const -> bool defaulted constexpr
Comparison with another multipole.

std::tuple compatibility

auto underlying_tuple() const -> const TensorTuple& constexpr
direct access to the tuple of tensors which comprises the multipole
auto underlying_tuple() -> TensorTuple& constexpr
direct access to the tuple of tensors which comprises the multipole
template<std::size_t I>
auto get() & -> auto& constexpr
element access for use with structured bindings
template<std::size_t I>
auto get() const & -> const auto& constexpr
element access for use with structured bindings
template<std::size_t I>
auto get() && -> auto&& constexpr
element access for use with structured bindings

Function documentation

template<class Implementation, typename ... Tensors>
symtensor::MultipoleBase<Implementation, Tensors>::MultipoleBase() explicit defaulted constexpr

Default constructor.

Invokes the default constructor for all contained tensors.

template<class Implementation, typename ... Tensors>
ALWAYS_INLINE symtensor::MultipoleBase<Implementation, Tensors>::MultipoleBase(const Tensors&... types) explicit constexpr

Constructor from a sequence of tensors.

Parameters
types The values for each tensor contained in the multipole. So long as each tensor type has an implicit constructor, initializer-list syntax works.

template<class Implementation, typename ... Tensors> template<indexable Vector>
ALWAYS_INLINE symtensor::MultipoleBase<Implementation, Tensors>::MultipoleBase(const Vector& vector) explicit constexpr

Constructor from a single vector.

Template parameters
Vector vector type, must have a subscript operator and provide at least D elements
Parameters
vector base vector

Tensors are produced by repeatedly performing cartesian products with the vector.

template<class Implementation, typename ... Tensors> template<indexable Vector>
static ALWAYS_INLINE Implementation symtensor::MultipoleBase<Implementation, Tensors>::FromVector(const Vector& vector) constexpr

Creator method from a single vector.

Template parameters
Vector vector type, must have a subscript operator and provide at least D elements
Parameters
vector base vector

Tensors are produced by repeatedly performing cartesian products with the vector.

template<class Implementation, typename ... Tensors> template<std::size_t R>
const auto& symtensor::MultipoleBase<Implementation, Tensors>::tensor() const constexpr

Tensor access by rank.

Template parameters
R Rank of the tensor to retrieve
Returns reference to the tensor with the requested rank

template<class Implementation, typename ... Tensors> template<std::size_t R>
auto& symtensor::MultipoleBase<Implementation, Tensors>::tensor() constexpr

Tensor access by rank.

Template parameters
R Rank of the tensor to retrieve
Returns reference to the tensor with the requested rank

template<class Implementation, typename ... Tensors> template<Index... Indices>
const auto& symtensor::MultipoleBase<Implementation, Tensors>::at() const constexpr

Direct access to members of tensors.

Template parameters
Indices Sequence of R Index values which specify an element of a tensor. The number of indices determines which tensor is accessed. Indices may be in arbitrary order, because the tensor is symmetric.
Returns the scalar element at the requested index

Passes through to the appropriate symmetric tensor member accessor SymmetricTensorBase::at.

template<class Implementation, typename ... Tensors> template<Index... Indices>
auto& symtensor::MultipoleBase<Implementation, Tensors>::at() constexpr

Direct access to members of tensors.

Template parameters
Indices Sequence of R Index values which specify an element of a tensor. The number of indices determines which tensor is accessed. Indices may be in arbitrary order, because the tensor is symmetric.
Returns the scalar element at the requested index

Passes through to the appropriate symmetric tensor member accessor SymmetricTensorBase::at.

template<class Implementation, typename ... Tensors> template<typename T>
Implementation& symtensor::MultipoleBase<Implementation, Tensors>::operator+=(const T& scalar) constexpr

Element-wise addition of a scalar.

Parameters
scalar value to add to each tensor of the multipole
Returns the modified multipole

template<class Implementation, typename ... Tensors> template<typename T>
Implementation& symtensor::MultipoleBase<Implementation, Tensors>::operator-=(const T& scalar) constexpr

Element-wise subtraction of a scalar.

Parameters
scalar value to subtract from each tensor of the multipole
Returns the modified multipole

template<class Implementation, typename ... Tensors> template<typename T>
Implementation& symtensor::MultipoleBase<Implementation, Tensors>::operator*=(const T& scalar) constexpr

Element-wise multiplication by a scalar.

Parameters
scalar value to multiply each tensor of the multipole by.
Returns the modified multipole

template<class Implementation, typename ... Tensors> template<typename T>
Implementation& symtensor::MultipoleBase<Implementation, Tensors>::operator/=(const T& scalar) constexpr

Element-wise division by a scalar.

Parameters
scalar value to divide each element of the multipole by.
Returns the modified multipole

template<class Implementation, typename ... Tensors> template<typename T>
Implementation symtensor::MultipoleBase<Implementation, Tensors>::operator+(const T& scalar) const constexpr

Element-wise addition of a scalar.

Parameters
scalar value to add to each tensor of the multipole
Returns the modified multipole

template<class Implementation, typename ... Tensors> template<typename T>
Implementation symtensor::MultipoleBase<Implementation, Tensors>::operator-(const T& scalar) const constexpr

Element-wise subtraction of a scalar.

Parameters
scalar value to subtract from each tensor of the multipole
Returns the modified multipole

template<class Implementation, typename ... Tensors> template<typename T>
Implementation symtensor::MultipoleBase<Implementation, Tensors>::operator*(const T& scalar) const constexpr

Element-wise multiplication by a scalar.

Parameters
scalar value to multiply each tensor of the multipole by.
Returns the modified multipole

template<class Implementation, typename ... Tensors> template<typename T>
Implementation symtensor::MultipoleBase<Implementation, Tensors>::operator/(const T& scalar) const constexpr

Element-wise division by a scalar.

Parameters
scalar value to divide each element of the multipole by.
Returns the modified multipole

template<class Implementation, typename ... Tensors>
Implementation& symtensor::MultipoleBase<Implementation, Tensors>::operator+=(const Implementation& other) constexpr

Element-wise addition with another multipole.

Parameters
other multipole to add with this multipole
Returns the modified multipole

template<class Implementation, typename ... Tensors>
Implementation& symtensor::MultipoleBase<Implementation, Tensors>::operator-=(const Implementation& other) constexpr

Element-wise subtraction by another multipole.

Parameters
other multipole to subtract from this multipole
Returns the modified multipole

template<class Implementation, typename ... Tensors>
Implementation& symtensor::MultipoleBase<Implementation, Tensors>::operator*=(const Implementation& other) constexpr

Element-wise multiplication by another multipole.

Parameters
other multipole to multiply with this multipole
Returns the modified multipole

template<class Implementation, typename ... Tensors>
Implementation& symtensor::MultipoleBase<Implementation, Tensors>::operator/=(const Implementation& other) constexpr

Element-wise division by another multipole.

Parameters
other multipole to divide this multipole by
Returns the modified multipole

template<class Implementation, typename ... Tensors>
Implementation symtensor::MultipoleBase<Implementation, Tensors>::operator+(const Implementation& other) const constexpr

Element-wise addition with another multipole.

Parameters
other multipole to add with this multipole
Returns the modified multipole

template<class Implementation, typename ... Tensors>
Implementation symtensor::MultipoleBase<Implementation, Tensors>::operator-(const Implementation& other) const constexpr

Element-wise subtraction by another multipole.

Parameters
other multipole to subtract from this multipole
Returns the modified multipole

template<class Implementation, typename ... Tensors>
Implementation symtensor::MultipoleBase<Implementation, Tensors>::operator*(const Implementation& other) const constexpr

Element-wise multiplication by another multipole.

Parameters
other multipole to multiply with this multipole
Returns the modified multipole

template<class Implementation, typename ... Tensors>
Implementation symtensor::MultipoleBase<Implementation, Tensors>::operator/(const Implementation& other) const constexpr

Element-wise division by another multipole.

Parameters
other multipole to divide this multipole by
Returns the modified multipole

template<class Implementation, typename ... Tensors>
bool symtensor::MultipoleBase<Implementation, Tensors>::operator==(const Self& other) const defaulted constexpr

Comparison with another multipole.

Parameters
other multipole to compare with
Returns true if all elements of the multipoles are equivalent, false otherwise

template<class Implementation, typename ... Tensors>
const TensorTuple& symtensor::MultipoleBase<Implementation, Tensors>::underlying_tuple() const constexpr

direct access to the tuple of tensors which comprises the multipole

Returns reference to the std::tuple of tensors.

template<class Implementation, typename ... Tensors>
TensorTuple& symtensor::MultipoleBase<Implementation, Tensors>::underlying_tuple() constexpr

direct access to the tuple of tensors which comprises the multipole

Returns reference to the std::tuple of tensors.

template<class Implementation, typename ... Tensors> template<std::size_t I>
auto& symtensor::MultipoleBase<Implementation, Tensors>::get() & constexpr

element access for use with structured bindings

Template parameters
I index of the element to retrieve (not necessarily the same as Rank)
Returns reference to the tensor

template<class Implementation, typename ... Tensors> template<std::size_t I>
const auto& symtensor::MultipoleBase<Implementation, Tensors>::get() const & constexpr

element access for use with structured bindings

Template parameters
I index of the element to retrieve (not necessarily the same as Rank)
Returns reference to the tensor

template<class Implementation, typename ... Tensors> template<std::size_t I>
auto&& symtensor::MultipoleBase<Implementation, Tensors>::get() && constexpr

element access for use with structured bindings

Template parameters
I index of the element to retrieve (not necessarily the same as Rank)
Returns reference to the tensor