Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

PR

Just a small problem.

I can fix it online!

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindquantum.core.operators.TimeEvolution

View Source On Gitee
class mindquantum.core.operators.TimeEvolution(ops: QubitOperator, time=None)[source]

The time evolution operator that can generate a corresponded circuit.

The time evolution operator will do the following evolution:

|φ(t)=eiHt|φ(0)

Note

The hamiltonian should be a parameterized or non parameterized QubitOperator. If the QubitOperator has multiple terms, the first order trotter decomposition will be used.

Parameters
  • ops (QubitOperator) – The qubit operator hamiltonian, could be parameterized or non parameterized.

  • time (Union[numbers.Number, dict, ParameterResolver]) – The evolution time, could be a number or a parameter resolver. If None, the time will be set to 1. Default: None.

Examples

>>> from mindquantum.core.operators import TimeEvolution, QubitOperator
>>> q1 = QubitOperator('Z0 Y1', 'a')
>>> q2 = QubitOperator('X0 Z1', 'b')
>>> ops1 = q1 + q2
>>> ops2 = q2 + q1
>>> TimeEvolution(ops1).circuit
                                          ┏━━━┓                                ┏━━━┓
q0: ────────────────■─────────────────■───┨ H ┠──────────■─────────────────■───┨ H ┠───
                    ┃                 ┃   ┗━━━┛          ┃                 ┃   ┗━━━┛
      ┏━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━┓ ┏━┻━┓
q1: ──┨ RX(π/2) ┠─┨╺╋╸┠─┨ RZ(2*a) ┠─┨╺╋╸┠─┨ RX(7π/2) ┠─┨╺╋╸┠─┨ RZ(2*b) ┠─┨╺╋╸┠─────────
      ┗━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━┛ ┗━━━┛
>>> TimeEvolution(ops2).circuit
      ┏━━━┓                         ┏━━━┓
q0: ──┨ H ┠───■─────────────────■───┨ H ┠─────────■─────────────────■──────────────────
      ┗━━━┛   ┃                 ┃   ┗━━━┛         ┃                 ┃
            ┏━┻━┓ ┏━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━━┓
q1: ────────┨╺╋╸┠─┨ RZ(2*b) ┠─┨╺╋╸┠─┨ RX(π/2) ┠─┨╺╋╸┠─┨ RZ(2*a) ┠─┨╺╋╸┠─┨ RX(7π/2) ┠───
            ┗━━━┛ ┗━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━━┛
property circuit

Get the first order trotter decomposition circuit of this time evolution operator.