Function sequant::is_valid(const ResultExpr&, std::string *)¶
Defined in File expr.cpp
Function Documentation¶
-
bool sequant::is_valid(const ResultExpr &expr, std::string *msg)¶
Checks whether the given expression is valid (i.e. uses consistent indexing etc.)
Unlike a bare Sum, a Sum on the rhs may broadcast: its summands may have different external indices if each is a subset of the result’s indices and together they are all of them. A result index is never contracted, so a term that uses it in several slots (a Hadamard product) supplies it. A summand that is broadcast must not trace over an index if it has a single non-scalar factor, a tensor.
- Parameters:
expr – The expression to validate
msg – If given, the function will set the string to a message describing why the provided expression is considered to be invalid. If the expression is valid, the string will be left unchanged.
- Returns:
The validity of the expression