Function sequant::is_valid(const ResultExpr&, std::string *)

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.

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