SpECTRE
v2025.03.17
|
Defines the tensor expression representing the quotient of one tensor expression divided by another tensor expression that evaluates to a rank 0 tensor. More...
#include <Divide.hpp>
Public Types | |
using | type = implementation defined |
The type of the data being stored in the result of the expression. | |
using | symmetry = typename T1::symmetry |
The Symmetry of the result of the expression. | |
using | index_list = typename T1::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. | |
Public Member Functions | |
Divide (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... | |
decltype(auto) | get (const std::array< size_t, num_tensor_indices > &result_multi_index) const |
Return the value of the component of the quotient tensor at a given multi-index. 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 of the quotient tensor at a given multi-index. 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 dividing. 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 Public Attributes | |
static constexpr auto | num_tensor_indices |
The number of tensor indices in the result of the expression. More... | |
static constexpr auto | op2_num_tensor_indices |
The number of tensor indices in the left operand expression. More... | |
static constexpr auto | op2_multi_index |
The multi-index for the denominator. 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... | |
Defines the tensor expression representing the quotient of one tensor expression divided by another tensor expression that evaluates to a rank 0 tensor.
For details on aliases and members defined in this class, as well as general TensorExpression
terminology used in its members' documentation, see documentation for TensorExpression
.
T1 | the numerator operand expression of the division expression |
T2 | the denominator operand expression of the division expression |
Args2 | the generic indices of the denominator expression |
|
inline |
Assert that each instance of the LHS tensor in the RHS tensor expression uses the same generic index order that the LHS uses.
LhsTensorIndices | the list of generic TensorIndex s of the LHS result Tensor being computed |
lhs_tensor | the LHS result Tensor being computed |
|
inline |
Evaluate the LHS Tensor's result component at this subtree by evaluating the two operand's subtrees separately and dividing.
This function takes into account whether we have already computed part of the result component at a lower subtree. In recursively computing this quotient, the current result component will be substituted in for the most recent (highest) subtree below it that has already been evaluated.
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.
result_component | the LHS tensor component to evaluate |
result_multi_index | the multi-index of the component of the result tensor to evaluate |
|
inline |
Successively evaluate the LHS Tensor's result component at each leg in this expression's subtree.
This function takes into account whether we have already computed part of the result component at a lower subtree. In recursively computing this quotient, the current result component will be substituted in for the most recent (highest) subtree below it that has already been evaluated.
result_component | the LHS tensor component to evaluate |
result_multi_index | the multi-index of the component of the result tensor to evaluate |
|
inline |
Return the value of the component of the quotient tensor at a given multi-index.
result_multi_index | the multi-index of the component of the quotient / tensor to retrieve |
Returns: the value of the component in the quotient tensor at result_multi_index
|
inline |
Return the value of the component of the quotient tensor at a given multi-index.
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 quotient, the current result component will be substituted in for the most recent (highest) subtree below it that has already been evaluated.
result_component | the LHS tensor component to evaluate |
result_multi_index | the multi-index of the component of the quotient / tensor to retrieve |
Returns: the value of the component in the quotient tensor at result_multi_index
|
inline |
|
staticconstexpr |
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.
|
staticconstexpr |
The height of this expression's node in the expression tree relative to the closest TensorAsExpression
leaf in its subtree.
|
staticconstexpr |
If on the primary path, whether or not the expression is a starting point of a leg.
|
staticconstexpr |
The total number of arithmetic tensor operations done in this expression's whole subtree.
|
staticconstexpr |
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.
|
staticconstexpr |
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
.
|
staticconstexpr |
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.
|
staticconstexpr |
The number of tensor indices in the result of the expression.
|
staticconstexpr |
The multi-index for the denominator.
|
staticconstexpr |
The number of tensor indices in the left operand expression.
|
staticconstexpr |
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.
|
staticconstexpr |
If on the primary path, whether or not this subtree contains a starting point of a leg along the primary path.