|
using | type = typename detail::AddSubType< T1, T2 >::type |
| The type of the data being stored in the result of the expression.
|
|
using | symmetry = typename detail::AddSubType< T1, T2 >::symmetry |
| The Symmetry of the result of the expression.
|
|
using | index_list = typename detail::AddSubType< T1, T2 >::index_list |
| The list of TensorIndexTypes of the result of the expression.
|
|
using | args_list = typename T1::args_list |
| The list of generic TensorIndex s of the result of the expression.
|
|
|
| AddSub (T1 t1, T2 t2) |
|
template<typename LhsTensor > |
void | assert_lhs_tensor_not_in_rhs_expression (const gsl::not_null< LhsTensor * > lhs_tensor) const |
| Assert that the LHS tensor of the equation does not also appear in this expression's subtree.
|
|
template<typename LhsTensorIndices , typename LhsTensor > |
void | assert_lhs_tensorindices_same_in_rhs (const gsl::not_null< LhsTensor * > lhs_tensor) const |
| Assert that each instance of the LHS tensor in the RHS tensor expression uses the same generic index order that the LHS uses. More...
|
|
size_t | get_rhs_tensor_component_size () const |
| Get the size of a component from a Tensor in this expression's subtree of the RHS TensorExpression More...
|
|
std::array< size_t, num_tensor_indices_op2 > | get_op2_multi_index (const std::array< size_t, num_tensor_indices > &op1_multi_index) const |
| Return the second operand's multi-index given the first operand's multi-index. More...
|
|
decltype(auto) | add_or_subtract (const std::array< size_t, num_tensor_indices > &op1_multi_index, const std::array< size_t, num_tensor_indices_op2 > &op2_multi_index) const |
| Helper function for computing the sum of or difference between components at given multi-indices from both operands of the expression. More...
|
|
decltype(auto) | get (const std::array< size_t, num_tensor_indices > &result_multi_index) const |
| Return the value of the component at the given multi-index of the tensor resulting from addition or subtraction. More...
|
|
template<typename ResultType > |
void | add_or_subtract_primary_children (ResultType &result_component, const std::array< size_t, num_tensor_indices > &op1_multi_index, const std::array< size_t, num_tensor_indices_op2 > &op2_multi_index) const |
| Helper for evaluating the LHS Tensor's result component at this subtree by evaluating the two operand's subtrees separately and adding or subtracting them. More...
|
|
template<typename ResultType > |
void | evaluate_primary_children (ResultType &result_component, const std::array< size_t, num_tensor_indices > &result_multi_index) const |
| Evaluate the LHS Tensor's result component at this subtree by evaluating the two operand's subtrees separately and adding or subtracting them. More...
|
|
template<typename ResultType > |
decltype(auto) | add_or_subtract_primary (const ResultType &result_component, const std::array< size_t, num_tensor_indices > &op1_multi_index, const std::array< size_t, num_tensor_indices_op2 > &op2_multi_index) const |
| Helper function for returning the sum of or difference between components at given multi-indices from both operands of the expression. More...
|
|
template<typename ResultType > |
decltype(auto) | get_primary (const ResultType &result_component, const std::array< size_t, num_tensor_indices > &result_multi_index) const |
| Return the value of the component at the given multi-index of the tensor resulting from addition or subtraction. More...
|
|
template<typename ResultType > |
void | evaluate_primary_subtree (ResultType &result_component, const std::array< size_t, num_tensor_indices > &result_multi_index) const |
| Successively evaluate the LHS Tensor's result component at each leg in this expression's subtree. More...
|
|
|
static constexpr auto | num_tensor_indices = tmpl::size<index_list>::value |
| The number of tensor indices in the result of the expression. This also doubles as the left operand's number of indices.
|
|
static constexpr auto | num_tensor_indices_op2 = sizeof...(Args2) |
| The number of tensor indices in the right operand expression.
|
|
static constexpr std::array< size_t, num_tensor_indices_op2 > | operand_index_transformation |
| Mapping from the left operand's index order to the right operand's index order. More...
|
|
static constexpr auto | op1_spatial_spacetime_index_positions |
| Positions of indices in first operand where generic spatial indices are used for spacetime indices. More...
|
|
static constexpr auto | op2_spatial_spacetime_index_positions |
| Positions of indices in second operand where generic spatial indices are used for spacetime indices. More...
|
|
static constexpr bool | ops_have_generic_indices_at_same_positions |
| Whether or not the two operands have the same TensorIndex s in the same order (including concrete time indices) More...
|
|
static constexpr size_t | num_ops_left_child = T1::num_ops_subtree |
| The number of arithmetic tensor operations done in the subtree for the left operand.
|
|
static constexpr size_t | num_ops_right_child = T2::num_ops_subtree |
| The number of arithmetic tensor operations done in the subtree for the right operand.
|
|
static constexpr size_t | num_ops_subtree |
| The total number of arithmetic tensor operations done in this expression's whole subtree. More...
|
|
static constexpr size_t | height_relative_to_closest_tensor_leaf_in_subtree |
| The height of this expression's node in the expression tree relative to the closest TensorAsExpression leaf in its subtree. More...
|
|
static constexpr bool | is_primary_end = T1::is_primary_start |
| If on the primary path, whether or not the expression is an ending point of a leg.
|
|
static constexpr size_t | num_ops_to_evaluate_primary_left_child |
| If on the primary path, this is the remaining number of arithmetic tensor operations that need to be done in the subtree of the child along the primary path, given that we will have already computed the whole subtree at the next lowest leg's starting point. More...
|
|
static constexpr size_t | num_ops_to_evaluate_primary_right_child |
| If on the primary path, this is the remaining number of arithmetic tensor operations that need to be done in the right operand's subtree. No splitting is currently done, so this is just num_ops_right_child . More...
|
|
static constexpr size_t | num_ops_to_evaluate_primary_subtree |
| If on the primary path, this is the remaining number of arithmetic tensor operations that need to be done for this expression's subtree, given that we will have already computed the subtree at the next lowest leg's starting point. More...
|
|
static constexpr bool | is_primary_start |
| If on the primary path, whether or not the expression is a starting point of a leg. More...
|
|
static constexpr bool | evaluate_children_separately |
| When evaluating along a primary path, whether each operand's subtrees should be evaluated separately. Since DataVector expression runtime scales poorly with increased number of operations, evaluating the two expression subtrees separately like this is beneficial when at least one of the subtrees contains a large number of operations. More...
|
|
static constexpr bool | primary_child_subtree_contains_primary_start |
| If on the primary path, whether or not the expression's child along the primary path is a subtree that contains a starting point of a leg along the primary path. More...
|
|
static constexpr bool | primary_subtree_contains_primary_start |
| If on the primary path, whether or not this subtree contains a starting point of a leg along the primary path. More...
|
|
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
Helper function for computing the sum of or difference between components at given multi-indices from both operands of the expression.
Details
Both multi-index arguments must be ordered according to their operand's respective generic index ordering
- Parameters
-
op1_multi_index | the multi-index of the component of the first operand |
op2_multi_index | the multi-index of the component of the second operand |
Returns: the sum of or difference between the two components' values
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
template<typename ResultType >
Helper function for returning the sum of or difference between components at given multi-indices from both operands of the expression.
Details
This function differs from add_or_subtract
in that it takes into account whether we have already computed part of the result component at a lower subtree. In recursively computing this sum/difference, the current result component will be substituted in for the most recent (highest) subtree below it that has already been evaluated.
- Parameters
-
result_component | the LHS tensor component to evaluate |
op1_multi_index | the multi-index of the component of the first operand |
op2_multi_index | the multi-index of the component of the second operand |
Returns: the sum of or difference between the two components' values
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
template<typename ResultType >
Helper for evaluating the LHS Tensor's result component at this subtree by evaluating the two operand's subtrees separately and adding or subtracting them.
Details
The left and right operands' subtrees are evaluated successively with two separate assignments to the LHS result component. Since DataVector
expression runtime scales poorly with increased number of operations, evaluating the two expression subtrees separately like this is beneficial when at least one of the subtrees contains a large number of operations. Instead of evaluating a larger expression with their combined total number of operations, we evaluate two smaller ones.
This function also differs from add_or_subtract
in that it takes into account whether we have already computed part of the result component at a lower subtree. In recursively computing this sum/difference, the current result component will be substituted in for the most recent (highest) subtree below it that has already been evaluated.
- Parameters
-
result_component | the LHS tensor component to evaluate |
op1_multi_index | the multi-index of the component of the first operand of the sum or difference to evaluate |
op2_multi_index | the multi-index of the component of the second operand of the sum or difference to evaluate |
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
template<typename LhsTensorIndices , typename LhsTensor >
void tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::assert_lhs_tensorindices_same_in_rhs |
( |
const gsl::not_null< LhsTensor * > |
lhs_tensor | ) |
const |
|
inline |
Assert that each instance of the LHS tensor in the RHS tensor expression uses the same generic index order that the LHS uses.
- Template Parameters
-
LhsTensorIndices | the list of generic TensorIndex s of the LHS result Tensor being computed |
- Parameters
-
lhs_tensor | the LHS result Tensor being computed |
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
template<typename ResultType >
void tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::evaluate_primary_children |
( |
ResultType & |
result_component, |
|
|
const std::array< size_t, num_tensor_indices > & |
result_multi_index |
|
) |
| const |
|
inline |
Evaluate the LHS Tensor's result component at this subtree by evaluating the two operand's subtrees separately and adding or subtracting them.
Details
See add_or_subtract_primary_children
for more details
- Parameters
-
result_component | the LHS tensor component to evaluate |
result_multi_index | the multi-index of the component of the result tensor to evaluate |
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
template<typename ResultType >
void tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::evaluate_primary_subtree |
( |
ResultType & |
result_component, |
|
|
const std::array< size_t, num_tensor_indices > & |
result_multi_index |
|
) |
| const |
|
inline |
Successively evaluate the LHS Tensor's result component at each leg in this expression's subtree.
Details
This function takes into account whether we have already computed part of the result component at a lower subtree. In recursively computing this sum/difference, the current result component will be substituted in for the most recent (highest) subtree below it that has already been evaluated.
- Parameters
-
result_component | the LHS tensor component to evaluate |
result_multi_index | the multi-index of the component of the result tensor to evaluate |
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
Return the value of the component at the given multi-index of the tensor resulting from addition or subtraction.
Details
One important detail to note about the type of the AddSub
expression is that its two operands may have (i) different generic index orders, and/or (ii) different indices in their index_list
s if where one operand uses a generic spatial index for a spacetime index, the other tensor may use that generic spatial index for a spatial index of the same dimension, valence, and frame. Therefore, there are four possible cases for an AddSub
expression that are considered in the implementation:
- same generic index order, spatial spacetime indices in expression
- same generic index order, spatial spacetime indices not in expression
- different generic index order, spatial spacetime indices in expression
- different generic index order, spatial spacetime indices not in expression
This means that for expressions where the generic index orders differ, a multi-index for a component of one operand is a (possible) rearrangement of the equivalent multi-index for a component in the other operand. This also means that for expressions where (at least once) a generic spatial index is used for a spacetime index, then, after accounting for potential reordering due to different generic index orders, a multi-index's values for a component of one operand are (possibly) shifted by one, compared to the multi-index's values for a component in the other operand.
For example, given \(R_{ij} + S_{ji}\), let \(R\)'s first index be a spacetime index, but \(R\)'s second index and both of \(S\)' indices be spatial indices. If \(i = 2\) and \(j = 0\), then when we compute \(R_{20} + S_{02}\), the multi-index for \(R_{20}\) is {2 + 1, 0} = {3, 0}
(first value shifted because it is a spacetime index) and the multi-index for \(S_{02}\) is [0, 2]
. Because the first operand of an AddSub
expresion propagates its generic index order and index list ( TensorIndexTypes) as the AddSub
's own generic index order and index list, the result_multi_index
is equivalent to the multi-index for the first operand. Thus, we need only compute the second operand's multi-index as a transformation of the first: reorder and shift the values of the first operand to compute the equivalent multi-index for the second operand.
- Parameters
-
result_multi_index | the multi-index of the component of the result tensor to retrieve |
Returns: the value of the component at result_multi_index
in the result tensor
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
Return the second operand's multi-index given the first operand's multi-index.
- Parameters
-
op1_multi_index | the multi-index of the left operand |
Returns: the second operand's multi-index
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
template<typename ResultType >
decltype(auto) tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::get_primary |
( |
const ResultType & |
result_component, |
|
|
const std::array< size_t, num_tensor_indices > & |
result_multi_index |
|
) |
| const |
|
inline |
Return the value of the component at the given multi-index of the tensor resulting from addition or subtraction.
Details
This function differs from get
in that it takes into account whether we have already computed part of the result component at a lower subtree. In recursively computing this sum/difference, the current result component will be substituted in for the most recent (highest) subtree below it that has already been evaluated.
- Parameters
-
result_component | the LHS tensor component to evaluate |
result_multi_index | the multi-index of the component of the result tensor to retrieve |
Returns: the value of the component at result_multi_index
in the result tensor
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
size_t tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::get_rhs_tensor_component_size |
( |
| ) |
const |
|
inline |
Get the size of a component from a Tensor
in this expression's subtree of the RHS TensorExpression
Returns: the size of a component from a Tensor
in this expression's subtree of the RHS TensorExpression
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
constexpr size_t tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::height_relative_to_closest_tensor_leaf_in_subtree |
|
staticconstexpr |
Initial value:=
T2::height_relative_to_closest_tensor_leaf_in_subtree <=
T1::height_relative_to_closest_tensor_leaf_in_subtree
? (T2::height_relative_to_closest_tensor_leaf_in_subtree !=
? T2::height_relative_to_closest_tensor_leaf_in_subtree + 1
: T2::height_relative_to_closest_tensor_leaf_in_subtree)
: T1::height_relative_to_closest_tensor_leaf_in_subtree + 1
The height of this expression's node in the expression tree relative to the closest TensorAsExpression
leaf in its subtree.
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
constexpr size_t tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::num_ops_to_evaluate_primary_left_child |
|
staticconstexpr |
Initial value:=
static constexpr bool is_primary_end
If on the primary path, whether or not the expression is an ending point of a leg.
Definition: AddSubtract.hpp:397
If on the primary path, this is the remaining number of arithmetic tensor operations that need to be done in the subtree of the child along the primary path, given that we will have already computed the whole subtree at the next lowest leg's starting point.
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
constexpr size_t tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::num_ops_to_evaluate_primary_right_child |
|
staticconstexpr |
Initial value:
If on the primary path, this is the remaining number of arithmetic tensor operations that need to be done in the right operand's subtree. No splitting is currently done, so this is just num_ops_right_child
.
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
constexpr size_t tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::num_ops_to_evaluate_primary_subtree |
|
staticconstexpr |
Initial value:
If on the primary path, this is the remaining number of arithmetic tensor operations that need to be done for this expression's subtree, given that we will have already computed the subtree at the next lowest leg's starting point.
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
constexpr auto tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::op1_spatial_spacetime_index_positions |
|
staticconstexpr |
Initial value:=
detail::get_spatial_spacetime_index_positions<typename T1::index_list,
ArgsList1<Args1...>>()
Positions of indices in first operand where generic spatial indices are used for spacetime indices.
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
constexpr auto tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::op2_spatial_spacetime_index_positions |
|
staticconstexpr |
Initial value:=
detail::get_spatial_spacetime_index_positions<typename T2::index_list,
ArgsList2<Args2...>>()
Positions of indices in second operand where generic spatial indices are used for spacetime indices.
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
constexpr bool tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::ops_have_generic_indices_at_same_positions |
|
staticconstexpr |
Initial value:=
typename detail::generic_indices_at_same_positions_impl< TensorIndexList1, TensorIndexList2, tmpl::size< TensorIndexList1 >::value==tmpl::size< TensorIndexList2 >::value >::type generic_indices_at_same_positions
Determine whether or not two lists of TensorIndexs contain the same generic indices at the same posit...
Definition: TensorIndex.hpp:323
Whether or not the two operands have the same TensorIndex
s in the same order (including concrete time indices)
template<typename T1 , typename T2 , template< typename... > class ArgsList1, template< typename... > class ArgsList2, typename... Args1, typename... Args2, int Sign>
constexpr bool tenex::AddSub< T1, T2, ArgsList1< Args1... >, ArgsList2< Args2... >, Sign >::primary_child_subtree_contains_primary_start |
|
staticconstexpr |
Initial value:=
T1::primary_subtree_contains_primary_start
If on the primary path, whether or not the expression's child along the primary path is a subtree that contains a starting point of a leg along the primary path.