Home Reference Source

References

backends

summary
public
public

backends/circuits

summary
public
public
private
private

V _exports: {"write_settings": function, "get_default_settings": function, "_header": function, "_body": function, "_footer": function}

backends/ibm

summary
public
public

backends/simulators

summary
public
public
public
public
public

V All: *

cengines

summary
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

Returns the circuit depth to execute these swaps.

public

cengines/replacer

summary
public
public
public
public

libs

summary
public

F arrayEqual(a1: Array, a2: Array, itemCompareFunc: function): boolean

test if two array(a1, a2) are equal, support instance of classes in this library

public

F arrayFromRange(start: number, end: number, step: number): number[]

create an array filled by number in range, active like python does

public

F complexVectorDot(a1: Complex[], a2: Complex[]): Complex

return dot product of two complex vector(a1, a2)

public

F expmod(base: number, exp: number, mod: number): number

return (base ^ exp) % mod, it's fast and support big number

public

F intersection(s1: Set, s2: Set): Set

return intersection of s1 & s2

public

F isComplex(value: Object): boolean

check if value is complex number

public

F isNumeric(value: Object): boolean

check if value is number or complex number

public

F len(v: any): number

return length of v, act like python

public

F narray(item: Function | any, count: number): Array

return n-length Array filled by item

public

F productLoop(p1: Array, p2: Array, func: function)

product loop on two Arrays p1 & p2

public

F productLoop3(p1: Array, p2: Array, p3: Array, func: function)

product loop on three Arrays p1 & p2 & p3

public

F randomSample(array: any[], count: number): any[]

return a random sample from array which length is count

public

F setDifference(s1: *, s2: *): *

public

F setEqual(s1: Set, s2: Set): boolean

check if s1 is equal to s2

public

create a Set contains numbers in range from 0 to n

public

F setIsSuperSet(superset: Set, s: Set): boolean

check if superset is the super set of s

public

parse string contains 1/0 into bit array

public

F symmetricDifference(s1: Set, s2: Set): Set<*>

return symmetric difference of s1 & s2

public

F unionSet(s1: Set, s2: Set): Set<any>

return union set of s1 & s2

public

create copy of object, with same class

public

check if an array is tuple

public

return class hierachy of cls

public

F genString(item: string, n: number): string

return item * n string like python does.

public

F instanceOf(inst: any, cls: function): boolean

check if inst is instance of cls, specialized for some class

public

F isKindclassOf(cls: function, superClass: function): boolean

check if cls is kind of superClass, will return true if cls is superClass

public

F isSubclassOf(cls: function, superClass: function): boolean

check if cls is subclass of superClass, will return false if cls is superClass

public

F markTuple(value: *)

force mark a value as tuple, internal usage only

public

F matrixDot(matrix: math.matrix, vector: number[]): math.matrix

dot product of matrix & vector

public

F matrixGetRow(matrix: math.matrix, index: number): number[]

return a row of matrix

public

F matrixRangeAssign(matrix: math.matrix, indices: number[], vector: number[])

assign value in vector into matrix by index in indices

public

F matrixRangeIndicesAssign(matrix: *, mstart: *, mend: *, vector: *, vstart: *)

public

F tuple(args: *): Array

create tuple from arguments

public

F zeros(n: number): number[]

generate a n-Length Array filled by 0

libs/math

summary
public
public
public
public

F add_constant(eng: *, c: *, quint: *)

Adds a classical constant c to the quantum integer (qureg) quint using Draper addition.

public

F add_constant_modN(eng: *, c: *, N: *, quint: *)

Adds a classical constant c to a quantum integer (qureg) quint modulo N using Draper addition and the construction from https://arxiv.org/abs/quant-ph/0205095.

public

F mul_by_constant_modN(eng: *, c: *, N: *, quint_in: *)

Multiplies a quantum integer by a classical number a modulo N, i.e.,

public

F SubConstant(a: number): *

Subtract a constant from a quantum number represented by a quantum register, stored from low- to high-bit.

public

Subtract a constant from a quantum number represented by a quantum register modulo N.

meta

summary
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

F Compute(engine: *, func: *)

Start a compute-section.

public

F CustomUncompute(engine: *, func: *)

Start a custom uncompute-section.

public

F Uncompute(engine: *)

Uncompute automatically.

public

F Control(engine: BasicEngine, qubits: Array<BasicQubit>, func: function)

Condition an entire code block on the value of qubits being 1.

public

F Dagger(engine: BasicEngine, func: function)

Invert an entire code block.

public

F Loop(engine: *, num: *, func: *)

Loop n times over an entire code block.

public

Removes an engine from the singly-linked list of engines.

public

F insertEngine(prevEngine: BasicEngine, engineToInsert: BasicEngine)

Inserts an engine into the singly-linked list of engines.

ops

summary
public abstract
public
public
public
public
public
public
public
public
public
public
public
public
public
public

C HGate

public
public

C Ph

public

C R

public

C Rx

public

C Ry

public

C Rz

public

C SGate

public
public
public
public

C TGate

public

C XGate

public

C YGate

public

C ZGate

public
public
public

C Tensor

public

Quantum Fourier Transform gate

public
public
public

F add(key: *, value: *)

public

F get(key: *): *

public

F getInverse(gate: BasicGate): *

Return the inverse of a gate.

public

F C(gate: BasicGate, n: number): *

Return n-controlled version of the provided gate.

public

F stringToArray(key: *): *

public

F CRz(angle: *): *

public
public
public
public

V H: HGate

public
public

V NOT: *

public

V S: SGate

public
public
public
public

V T: TGate

public

V X: XGate

public

V Y: YGate

public

V Z: ZGate

public

V obj: {}

public

V All: *

public
public

V PAULI_OPERATOR_PRODUCTS: {"undefined": *}

public

V CNOT: *

public

V CX: *

public

V CZ: *

public

V Toffoli: *

setups

summary
public

F getEngineList(num_rows: number, num_columns: number, one_qubit_gates: string | Array<BasicGate>, two_qubit_gates: string | Array<BasicGate>): undefined[]

Returns an engine list to compile to a 2-D grid of qubits.

public

F high_level_gates(eng: *, cmd: *): boolean

Remove any MathGates

public
public
public
public

F getEngineList(num_qubits: number, cyclic: boolean, one_qubit_gates: string | Array<BasicGate>, two_qubit_gates: string | Array<BasicGate>): Array

Returns an engine list to compile to a linear chain of qubits.

public

F getEngineList(one_qubit_gates: string | Array<BasicGate>, two_qubit_gates: string | Array<BasicGate>, other_gates: string | Array<BasicGate>): Array

Returns an engine list to compile to a restricted gate set.

public

setups/decompositions

summary
private

F _find_parameters(matrix: Array<number[]>): number[]

Given a 2x2 unitary matrix, find the parameters a, b/2, c/2, and d/2 such that matrix == [[exp(j(a-b/2-d/2))cos(c/2), -exp(j(a-b/2+d/2))sin(c/2)], [exp(j(a+b/2-d/2))sin(c/2), exp(j(a+b/2+d/2))cos(c/2)]]

private

Recognize an arbitrary one qubit gate which has a matrix property.

public

F phase(c: *): *

public
private

F _decompose_barrier(cmd: *)

private
private
private

F _recognize_v(matrix: Array<number[]>): boolean

Recognizes a matrix which can be written in the following form:

private

F _recognize_cnot(cmd: *)

private

F _decompose_CnU(cmd: *)

Decompose a multi-controlled gate U into a single-controlled U.

private

F _recognize_CnU(cmd: *): boolean

Recognize an arbitrary gate which has n>=2 control qubits, except a Toffoli gate.

private
private

F _decompose_ry(cmd: *)

private
public
public

types

summary
public
public

C Qubit

public

F Qureg(args: ...*): *