triqs.gfs.lazy_expressions.eval_expr

triqs.gfs.lazy_expressions.eval_expr(expr)[source]

Reduce expr using an evaluation context discovered in its terminals.

If expr is not a LazyExpr, it is returned unchanged. Otherwise the function looks for a terminal exposing __lazy_expr_eval_context__() (typically a Gf), checks that every such terminal yields a compatible context, and delegates to eval_expr_with_context().

Parameters:
exprLazyExpr or object

Expression to reduce. Non-LazyExpr values are returned unchanged.

Returns:
object

Reduced value of the expression (or expr itself if it was not a LazyExpr).

Raises:
ValueError

If no terminal can build an evaluation context, or if multiple terminals build incompatible contexts (e.g. Green’s functions on different meshes).