33 #ifndef EXATN_TENSOR_SYMBOL_HPP_
34 #define EXATN_TENSOR_SYMBOL_HPP_
36 #include "tensor_basic.hpp"
37 #include "tensor_leg.hpp"
47 LegDirection direction;
50 inline bool is_letter(
const char & ch){
51 return ((ch >=
'a' && ch <=
'z') || (ch >=
'A' && ch <=
'Z'));
54 inline bool is_number(
const char & ch){
55 return (ch >=
'0' && ch <=
'9');
58 inline bool is_underscore(
const char & ch){
62 inline bool is_space(
const char & ch){
66 inline bool is_conjugation_sign(
const char & ch){
70 inline bool is_equal_sign(
const char & ch){
74 inline bool is_plus_sign(
const char & ch){
78 inline bool is_minus_sign(
const char & ch){
82 inline bool is_multiply_sign(
const char & ch){
89 if(identifier.empty())
return false;
90 if(!is_letter(identifier[0]))
return false;
91 for(
const char & ch: identifier){
92 if(!(is_letter(ch) || is_number(ch) || is_underscore(ch)))
return false;
99 std::pair<int,int> view)
101 int sbeg = view.first;
102 int send = view.second;
105 if(!is_space(str[send]))
break;
109 if(!is_space(str[sbeg]))
break;
113 return std::make_pair(sbeg,send);
119 std::string & tensor_name,
120 std::vector<IndexLabel> & indices,
121 bool & complex_conjugated);
127 std::vector<std::string> & tensors);
139 unsigned int left_tensor_rank,
140 unsigned int right_tensor_rank,
141 std::string & symb_pattern);
145 #endif //EXATN_TENSOR_SYMBOL_HPP_
Definition: DriverClient.hpp:10
bool parse_tensor(const std::string &tensor, std::string &tensor_name, std::vector< IndexLabel > &indices, bool &complex_conjugated)
Definition: tensor_symbol.cpp:13
bool is_alphanumeric(const std::string &identifier)
Definition: tensor_symbol.hpp:87
bool parse_tensor_network(const std::string &network, std::vector< std::string > &tensors)
Definition: tensor_symbol.cpp:92
Definition: tensor_symbol.hpp:45
bool generate_contraction_pattern(const std::vector< numerics::TensorLeg > &pattern, unsigned int left_tensor_rank, unsigned int right_tensor_rank, std::string &symb_pattern)
Definition: tensor_symbol.cpp:134
std::pair< int, int > trim_spaces_off(const std::string &str, std::pair< int, int > view)
Definition: tensor_symbol.hpp:98