psyclone.psyad.utils

Utilities for the PSyclone Adjoint (PSyAD) functionality.

Functions

  • node_is_active(): Determines whether this node contains variables that are active.

  • node_is_passive(): Determines whether this node contains only variables that are

  • negate_expr(): Takes a PSyIR expression and negates it by multiplying it by minus

psyclone.psyad.utils.node_is_active(node, active_variables)

Determines whether this node contains variables that are active.

Parameters:
Returns:

True if active and False otherwise.

Return type:

bool

Raises:
  • TypeError – if the node argument is not a Node.

  • TypeError – if the active_variables argument is not a list.

  • ValueError – if the active variables list does not contain datasymbols or if the list does not contain strings.

psyclone.psyad.utils.node_is_passive(node, active_variables)

Determines whether this node contains only variables that are passive.

Parameters:
Returns:

True if passive and False otherwise.

Return type:

bool

psyclone.psyad.utils.negate_expr(orig_expr)

Takes a PSyIR expression and negates it by multiplying it by minus one. it is assumed that the expression returns an integer.

Parameters:

orig_expr (psyclone.psyir.nodes.DataNode) – the PSyIR expression to negate.

Returns:

the expression multiplied by minus one.

Rytpe:

psyclone.psyir.nodes.DataNode