Home Reference Source
import {Qureg} from 'projectq/src/types/qubit.js'
public class | source

Qureg

Extends:

Array → Qureg

Quantum register class. Simplifies accessing measured values for single-qubit registers (no []-access necessary) and enables pretty-printing of general quantum registers).

Constructor Summary

Public Constructor
public

constructor(args: ...any | number | Array)

a little different with Array: when pass an array as argument, will copy the passed array

Member Summary

Public Members
public get
public set

engine(newEngine: BasicEngine)

public

Method Summary

Public Methods
public

add(other: Array<Qubit> | Qureg): Qureg

add qubits from other, return a new Qureg instance

public

deallocate all qubit, then clear the qureg

public

equal(other: Qureg | Object): boolean

test if two Quregs are equal

public

only supported when length === 1, use the qubit value as qureg value

public

number representation

public

string description

Public Constructors

public constructor(args: ...any | number | Array) source

a little different with Array: when pass an array as argument, will copy the passed array

Params:

NameTypeAttributeDescription
args ...any | number | Array

Public Members

public get engine: BasicEngine: * source

Return:

BasicEngine

public set engine(newEngine: BasicEngine) source

public length: number source

Public Methods

public add(other: Array<Qubit> | Qureg): Qureg source

add qubits from other, return a new Qureg instance

Params:

NameTypeAttributeDescription
other Array<Qubit> | Qureg

Return:

Qureg

public deallocate() source

deallocate all qubit, then clear the qureg

public equal(other: Qureg | Object): boolean source

test if two Quregs are equal

Params:

NameTypeAttributeDescription
other Qureg | Object

Return:

boolean

public toBoolean(): boolean source

only supported when length === 1, use the qubit value as qureg value

Return:

boolean

Throw:

Error

will throw when length !== 1

public toNumber(): number source

number representation

Return:

number

public toString(): string source

string description

Return:

string