ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
container::einsum_utils Namespace Reference

Classes

struct  BCast

Enumerations

enum  EinsumDimensionType {
  kBroadcasting = 0 , kBatch = 1 , kFree = 2 , kContract = 3 ,
  kReduce = 4
}

Functions

bool ValidateEinsumEquation (const std::string &equation, std::vector< std::string > &input_subscripts, std::string &output_subscript)
 Check the validation of the input equations.
bool ParseEinsumEquation (const std::string &equation, std::vector< EinsumDimensionType > &label_types, std::vector< std::vector< int > > &input_labels, std::vector< int > &output_labels, std::vector< std::vector< int > > &input_label_counts, std::vector< int > &output_label_counts, std::vector< bool > &input_has_ellipsis, bool &output_has_ellipsis)
bool RecordLabelToDimension (const int label, const int axis, const Tensor &input, std::unordered_map< int, int64_t > &label_to_dim_sizes)
bool ProcessDimensions (const std::vector< const Tensor * > &inputs, std::vector< EinsumDimensionType > &label_types, std::vector< std::vector< int > > &input_labels, std::vector< int > &output_labels, std::vector< std::vector< int > > &input_label_counts, std::vector< int > &output_label_counts, const std::vector< bool > &input_has_ellipsis, const bool output_has_ellipsis, std::unordered_map< int, int64_t > &label_to_dim_sizes)
bool ReduceOperand (const Tensor &input, const std::vector< EinsumDimensionType > &label_types, std::vector< int > &labels, const std::vector< int > &label_counts, std::vector< int > &free_labels, int &swap_free_and_contract, Tensor &output)
bool ContractOperands (std::vector< Tensor > &inputs, const std::vector< int > &swap_free_and_contract, const EinsumOption &option, Tensor &output)
 A function to perform contraction operation on multiple Tensors.
void ProcessOutput (const Tensor &input, const std::vector< einsum_utils::EinsumDimensionType > &label_types, const std::vector< std::vector< int > > &free_labels, std::unordered_map< int, int64_t > &label_to_dim_sizes, const std::vector< int > &output_labels, const std::vector< int > &output_label_counts, Tensor &output)

Variables

constexpr int kEllipsisLabel = -1

Enumeration Type Documentation

◆ EinsumDimensionType

Enumerator
kBroadcasting 
kBatch 
kFree 
kContract 
kReduce 

Function Documentation

◆ ContractOperands()

bool container::einsum_utils::ContractOperands ( std::vector< Tensor > & inputs,
const std::vector< int > & swap_free_and_contract,
const EinsumOption & option,
Tensor & output )

A function to perform contraction operation on multiple Tensors.

This functor applies a contraction operation on multiple input Tensors and computes the result. The contraction operation combines the input Tensors based on a specific contraction pattern to produce a single output Tensor. The contraction pattern is defined by the swap_free_and_contract vector, which specifies whether each input Tensor should be contracted or simply copied to the output.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseEinsumEquation()

bool container::einsum_utils::ParseEinsumEquation ( const std::string & equation,
std::vector< EinsumDimensionType > & label_types,
std::vector< std::vector< int > > & input_labels,
std::vector< int > & output_labels,
std::vector< std::vector< int > > & input_label_counts,
std::vector< int > & output_label_counts,
std::vector< bool > & input_has_ellipsis,
bool & output_has_ellipsis )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessDimensions()

bool container::einsum_utils::ProcessDimensions ( const std::vector< const Tensor * > & inputs,
std::vector< EinsumDimensionType > & label_types,
std::vector< std::vector< int > > & input_labels,
std::vector< int > & output_labels,
std::vector< std::vector< int > > & input_label_counts,
std::vector< int > & output_label_counts,
const std::vector< bool > & input_has_ellipsis,
const bool output_has_ellipsis,
std::unordered_map< int, int64_t > & label_to_dim_sizes )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessOutput()

void container::einsum_utils::ProcessOutput ( const Tensor & input,
const std::vector< einsum_utils::EinsumDimensionType > & label_types,
const std::vector< std::vector< int > > & free_labels,
std::unordered_map< int, int64_t > & label_to_dim_sizes,
const std::vector< int > & output_labels,
const std::vector< int > & output_label_counts,
Tensor & output )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RecordLabelToDimension()

bool container::einsum_utils::RecordLabelToDimension ( const int label,
const int axis,
const Tensor & input,
std::unordered_map< int, int64_t > & label_to_dim_sizes )
Here is the caller graph for this function:

◆ ReduceOperand()

bool container::einsum_utils::ReduceOperand ( const Tensor & input,
const std::vector< EinsumDimensionType > & label_types,
std::vector< int > & labels,
const std::vector< int > & label_counts,
std::vector< int > & free_labels,
int & swap_free_and_contract,
Tensor & output )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ValidateEinsumEquation()

bool container::einsum_utils::ValidateEinsumEquation ( const std::string & equation,
std::vector< std::string > & input_subscripts,
std::string & output_subscript )

Check the validation of the input equations.

Here is the caller graph for this function:

Variable Documentation

◆ kEllipsisLabel

int container::einsum_utils::kEllipsisLabel = -1
constexpr