SpECTRE  v2024.05.11
tenex::SquareRoot< T, Args > Struct Template Reference

Defines the tensor expression representing the square root of a tensor expression that evaluates to a rank 0 tensor. More...

#include <SquareRoot.hpp>

Public Types

using type = typename T::type
 The type of the data being stored in the result of the expression.
 
using symmetry = typename T::symmetry
 The Symmetry of the result of the expression.
 
using index_list = typename T::index_list
 The list of TensorIndexTypes of the result of the expression.
 
using args_list = tmpl::list< Args... >
 The list of generic TensorIndexs of the result of the expression.
 

Public Member Functions

 SquareRoot (T t)
 
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 > &multi_index) const
 Returns the square root of the component of the tensor evaluated from the contained tensor expression. More...
 
template<typename ResultType >
decltype(auto) get_primary (const ResultType &result_component, const std::array< size_t, num_tensor_indices > &multi_index) const
 Returns the square root of the component of the tensor evaluated from the contained tensor expression. More...
 
template<typename ResultType >
void evaluate_primary_subtree (ResultType &result_component, const std::array< size_t, num_tensor_indices > &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 = sizeof...(Args)
 The number of tensor indices in the result of the expression.
 
static constexpr size_t num_ops_left_child = T::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 = 0
 The number of arithmetic tensor operations done in the subtree for the right operand. This is 0 because this expression represents a unary operation.
 
static constexpr size_t num_ops_subtree = num_ops_left_child + 1
 The total number of arithmetic tensor operations done in this expression's whole subtree.
 
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 = T::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 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...
 

Detailed Description

template<typename T, typename... Args>
struct tenex::SquareRoot< T, Args >

Defines the tensor expression representing the square root of a tensor expression that evaluates to a rank 0 tensor.

Details

The expression can have a non-zero number of indices as long as all indices are concrete time indices, as this represents 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.

Template Parameters
Tthe type of the tensor expression of which to take the square root
Argsthe TensorIndexs of the expression

Member Function Documentation

◆ assert_lhs_tensorindices_same_in_rhs()

template<typename T , typename... Args>
template<typename LhsTensorIndices , typename LhsTensor >
void tenex::SquareRoot< T, Args >::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
LhsTensorIndicesthe list of generic TensorIndexs of the LHS result Tensor being computed
Parameters
lhs_tensorthe LHS result Tensor being computed

◆ evaluate_primary_subtree()

template<typename T , typename... Args>
template<typename ResultType >
void tenex::SquareRoot< T, Args >::evaluate_primary_subtree ( ResultType &  result_component,
const std::array< size_t, num_tensor_indices > &  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 square root, the current result component will be substituted in for the most recent (highest) subtree below it that has already been evaluated.

Parameters
result_componentthe LHS tensor component to evaluate
multi_indexthe multi-index of the component of the result tensor to evaluate

◆ get()

template<typename T , typename... Args>
decltype(auto) tenex::SquareRoot< T, Args >::get ( const std::array< size_t, num_tensor_indices > &  multi_index) const
inline

Returns the square root of the component of the tensor evaluated from the contained tensor expression.

Details

SquareRoot only supports tensor expressions that evaluate to a rank 0 Tensor. This is why multi_index is always an array of size 0.

Parameters
multi_indexthe multi-index of the component of which to take the square root

Returns: the square root of the component of the tensor evaluated from the contained tensor expression

◆ get_primary()

template<typename T , typename... Args>
template<typename ResultType >
decltype(auto) tenex::SquareRoot< T, Args >::get_primary ( const ResultType &  result_component,
const std::array< size_t, num_tensor_indices > &  multi_index 
) const
inline

Returns the square root of the component of the tensor evaluated from the contained tensor expression.

Details

SquareRoot only supports tensor expressions that evaluate to a rank 0 Tensor. This is why multi_index is always an array of size 0.

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 square root, the current result component will be substituted in for the most recent (highest) subtree below it that has already been evaluated.

Parameters
result_componentthe LHS tensor component to evaluate
multi_indexthe multi-index of the component of which to take the square root

Returns: the square root of the component of the tensor evaluated from the contained tensor expression

◆ get_rhs_tensor_component_size()

template<typename T , typename... Args>
size_t tenex::SquareRoot< T, Args >::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

Member Data Documentation

◆ height_relative_to_closest_tensor_leaf_in_subtree

template<typename T , typename... Args>
constexpr size_t tenex::SquareRoot< T, Args >::height_relative_to_closest_tensor_leaf_in_subtree
staticconstexpr
Initial value:
=
T::height_relative_to_closest_tensor_leaf_in_subtree !=
? T::height_relative_to_closest_tensor_leaf_in_subtree + 1
: T::height_relative_to_closest_tensor_leaf_in_subtree
T max(T... args)

The height of this expression's node in the expression tree relative to the closest TensorAsExpression leaf in its subtree.

◆ is_primary_start

template<typename T , typename... Args>
constexpr bool tenex::SquareRoot< T, Args >::is_primary_start
staticconstexpr
Initial value:
=
detail::max_num_ops_in_sub_expression<type>
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 ...
Definition: SquareRoot.hpp:98

If on the primary path, whether or not the expression is a starting point of a leg.

◆ num_ops_to_evaluate_primary_left_child

template<typename T , typename... Args>
constexpr size_t tenex::SquareRoot< T, Args >::num_ops_to_evaluate_primary_left_child
staticconstexpr
Initial value:
=
is_primary_end ? 0 : T::num_ops_to_evaluate_primary_subtree
static constexpr bool is_primary_end
If on the primary path, whether or not the expression is an ending point of a leg.
Definition: SquareRoot.hpp:82

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.

◆ num_ops_to_evaluate_primary_right_child

template<typename T , typename... Args>
constexpr size_t tenex::SquareRoot< T, Args >::num_ops_to_evaluate_primary_right_child
staticconstexpr
Initial value:
=
static constexpr size_t num_ops_right_child
The number of arithmetic tensor operations done in the subtree for the right operand....
Definition: SquareRoot.hpp:64

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.

◆ num_ops_to_evaluate_primary_subtree

template<typename T , typename... Args>
constexpr size_t tenex::SquareRoot< T, Args >::num_ops_to_evaluate_primary_subtree
staticconstexpr
Initial value:
=
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 ...
Definition: SquareRoot.hpp:92
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 ...
Definition: SquareRoot.hpp:87

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.

◆ primary_child_subtree_contains_primary_start

template<typename T , typename... Args>
constexpr bool tenex::SquareRoot< T, Args >::primary_child_subtree_contains_primary_start
staticconstexpr
Initial value:
=
T::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.

◆ primary_subtree_contains_primary_start

template<typename T , typename... Args>
constexpr bool tenex::SquareRoot< T, Args >::primary_subtree_contains_primary_start
staticconstexpr
Initial value:
=
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 tha...
Definition: SquareRoot.hpp:109
static constexpr bool is_primary_start
If on the primary path, whether or not the expression is a starting point of a leg.
Definition: SquareRoot.hpp:103

If on the primary path, whether or not this subtree contains a starting point of a leg along the primary path.


The documentation for this struct was generated from the following file: