Home Reference Source
import TimeEvolution from 'projectq/src/ops/timeevolution.js'
public class | source

TimeEvolution

Extends:

BasicGate → TimeEvolution

Example:


    

Constructor Summary

Public Constructor
public

constructor(time: number, hamiltonian: QubitOperator)

Member Summary

Public Members
public
public

time: *

Method Summary

Public Methods
public

equal()

public

getInverse(): *

public

Return self merged with another TimeEvolution gate if possible.

public

or(qubits: Array<Qubit> | Qureg | Qubit)

Operator| overload which enables the following syntax:

public

Inherited Summary

From class BasicGate
public static

makeTupleOfQureg(qubits: Qubit | Qubit[] | Qureg | Qureg[]): Qureg[]

Convert quantum input of "gate | quantum input" to internal formatting.

public
public
public

equal(other: BasicGate | Object): boolean

public

generateCommand(qubits: *): Command

Helper function to generate a command consisting of the gate and the qubits being acted upon.

public
public
public
public

or(qubits: *)

Operator| overload which enables the syntax Gate | qubits.

public

Public Constructors

public constructor(time: number, hamiltonian: QubitOperator) source

Override:

BasicGate#constructor

Params:

NameTypeAttributeDescription
time number

time to evolve under (can be negative).

hamiltonian QubitOperator

hamiltonian to evolve under.

Throw:

Error

If time is not a numeric type and hamiltonian is not a QubitOperator.

NotHermitianOperatorError

If the input hamiltonian is not hermitian (only real coefficients).

Public Members

public hamiltonian: * source

public time: * source

Public Methods

public equal() source

Override:

BasicGate#equal

public getInverse(): * source

Override:

BasicGate#getInverse

Return:

*

public getMerged(other: TimeEvolution): TimeEvolution source

Return self merged with another TimeEvolution gate if possible.

Two TimeEvolution gates are merged if: 1) both have the same terms 2) the proportionality factor for each of the terms must have relative error <= 1e-9 compared to the proportionality factors of the other terms.

Note: While one could merge gates for which both hamiltonians commute, we are not doing this as in general the resulting gate would have to be decomposed again.

Note: We are not comparing if terms are proportional to each other with an absolute tolerance. It is up to the user to remove terms close to zero because we cannot choose a suitable absolute error which works for everyone. Use, e.g., a decomposition rule for that.

Override:

BasicGate#getMerged

Params:

NameTypeAttributeDescription
other TimeEvolution

TimeEvolution gate

Return:

TimeEvolution

New TimeEvolution gate equivalent to the two merged gates.

Throw:

NotMergeable

If the other gate is not a TimeEvolution gate or hamiltonians are not suitable for merging.

public or(qubits: Array<Qubit> | Qureg | Qubit) source

Operator| overload which enables the following syntax:

Override:

BasicGate#or

Params:

NameTypeAttributeDescription
qubits Array<Qubit> | Qureg | Qubit

one Qubit object, one list of Qubit objects, one Qureg object, or a tuple of the former three cases.

Example:


    

public toString(): string source

Override:

BasicGate#toString

Return:

string