inquanto-cutensornet

InQuanto cuTensorNet extension.

class CuTensorNetProtocol

Protocol for the pytket-cutensornet package for tensor network simulations.

get_evaluator(parameters, allow_partial=True)

Returns an evaluator function to evaluate quantum computables.

This method creates and returns a function (evaluator) that takes in a specific quantum computable and evaluates it based on its type. The returned evaluator handles various computable types, such as expectation values, their derivatives, overlaps, etc.

Quantum computables the returned evaluator can handle:

Parameters:
  • parameters (dict[str | Symbol, Union[int, float, complex, Expr]]) – Symbols and their values to be used in the evaluation.

  • allow_partial (bool, default: True) – If False, evaluation will fail when an unsupported computable node is encountered. If True, unsupported nodes will be skipped.

Raises:

NotImplementedError – If an unsupported computable is encountered, and allow_partial==False.

Returns:

Callable[[Any], Any] – A function that can evaluate quantum computables. If the Computable is supported by this protocol, it is computed; otherwise, it returns the Computable itself.

get_runner(qc)

Returns an end-to-end executor function for a quantum computable.

All nodes in the quantum computable must be evaluable by this protocol. Supported computable are:

Parameters:

qc (ComputableNode) – The quantum computable node to be measured and evaluated at every call of the returned function.

Returns:

Callable[[dict[str | Symbol, Union[int, float, complex, Expr]]], Any] – A function that takes the parameters and returns the evaluated result. If the result is not a float, it returns math.nan.