# openfermion.measurements.group_into_tensor_product_basis_sets

Split an operator (instance of QubitOperator) into `sub-operator`

QubitOperators, where each sub-operator has terms that are diagonal in the same tensor product basis.

Each `sub-operator` can be measured using the same qubit post-rotations in expectation estimation. Grouping into these tensor product basis sets has been found to improve the efficiency of expectation estimation significantly for some Hamiltonians in the context of VQE (see section V(A) in the supplementary material of https://arxiv.org/pdf/1704.05018v2.pdf). The more general problem of grouping operators into commutitative groups is discussed in section IV (B2) of https://arxiv.org/pdf/1509.04279v1.pdf The original input operator is the union of all output sub-operators, and all sub-operators are disjoint (do not share any terms).

operator (QubitOperator): the operator that will be split into sub-operators (tensor product basis sets). seed (int): default None. Random seed used to initialize the numpy.RandomState pseudo-random number generator.

sub_operators (dict): a dictionary where each key defines a tensor product basis, and each corresponding value is a QubitOperator with terms that are all diagonal in that basis. key (tuple of tuples): Each key is a term, which defines a tensor product basis. A term is a product of individual factors; each factor is represented by a tuple of the form (`index`, `action`), and these tuples are collected into a larger tuple which represents the term as the product of its factors. `action` is from the set {'X', 'Y', 'Z'} and `index` is a non-negative integer corresponding to the index of a qubit. value (QubitOperator): A QubitOperator with terms that are diagonal in the basis defined by the key it is stored in.

`TypeError` Operator of invalid type.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]