Welcome to pq-engine’s documentation!

pq_engine package

Submodules

pq_engine.exceptions module

exception pq_engine.exceptions.NonOneTraceError

Bases: PQEngineBaseError

error that trace of matrix is not 1.

message = 'trace of matrix is not 1.'
exception pq_engine.exceptions.NotHermiteError

Bases: PQEngineBaseError

error that matrix is not hermite

message = 'matrix is not hermite.'
exception pq_engine.exceptions.NotSquareError

Bases: PQEngineBaseError

error that matrix is not square.

message = 'matrix is not square.'
exception pq_engine.exceptions.NotUnitaryError

Bases: PQEngineBaseError

error that matrix is not unitary

message = 'matrix is not unitary.'
exception pq_engine.exceptions.PQEngineBaseError

Bases: Exception

base error class

exception pq_engine.exceptions.SizeNotMatchError

Bases: PQEngineBaseError

error that dimension is not matching

message = 'size of matrix is not match.'
exception pq_engine.exceptions.TargetNotFoundError

Bases: PQEngineBaseError

error that target is not found

message = 'target is not found.'

pq_engine.matricies module

pq_engine.matricies.controlled_not = array([[1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],        [0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j],        [0.+0.j, 0.+0.j, 0.+0.j, 1.+0.j],        [0.+0.j, 0.+0.j, 1.+0.j, 0.+0.j]], dtype=complex64)

controled-not matrix

pq_engine.matricies.create_matrix_from_vector(vector: ndarray) ndarray

create matrix from vector

Parameters:

vector (xp.ndarray) – source vector

Returns:

matrix converted by source vector

Return type:

xp.ndarray

pq_engine.matricies.epr_pair_matricies = [array([[0.49999997+0.j, 0.        +0.j, 0.        +0.j, 0.49999997+0.j],        [0.        +0.j, 0.        +0.j, 0.        +0.j, 0.        +0.j],        [0.        +0.j, 0.        +0.j, 0.        +0.j, 0.        +0.j],        [0.49999997+0.j, 0.        +0.j, 0.        +0.j, 0.49999997+0.j]],       dtype=complex64), array([[0.        +0.j, 0.        +0.j, 0.        +0.j, 0.        +0.j],        [0.        +0.j, 0.49999997+0.j, 0.49999997+0.j, 0.        +0.j],        [0.        +0.j, 0.49999997+0.j, 0.49999997+0.j, 0.        +0.j],        [0.        +0.j, 0.        +0.j, 0.        +0.j, 0.        +0.j]],       dtype=complex64), array([[ 0.        +0.j,  0.        +0.j,  0.        +0.j,          0.        +0.j],        [ 0.        +0.j,  0.49999997+0.j, -0.49999997+0.j,          0.        +0.j],        [ 0.        +0.j, -0.49999997+0.j,  0.49999997+0.j,          0.        +0.j],        [ 0.        +0.j,  0.        +0.j,  0.        +0.j,          0.        +0.j]], dtype=complex64), array([[ 0.49999997+0.j,  0.        +0.j,  0.        +0.j,         -0.49999997+0.j],        [ 0.        +0.j,  0.        +0.j,  0.        +0.j,          0.        +0.j],        [ 0.        +0.j,  0.        +0.j,  0.        +0.j,          0.        +0.j],        [-0.49999997+0.j,  0.        +0.j,  0.        +0.j,          0.49999997+0.j]], dtype=complex64)]

epr pairs state matricies

pq_engine.matricies.epr_pair_vectors = [array([0.70710677+0.j, 0.        +0.j, 0.        +0.j, 0.70710677+0.j],       dtype=complex64), array([0.        +0.j, 0.70710677+0.j, 0.70710677+0.j, 0.        +0.j],       dtype=complex64), array([ 0.        +0.j,  0.70710677+0.j, -0.70710677+0.j,  0.        +0.j],       dtype=complex64), array([ 0.70710677+0.j,  0.        +0.j,  0.        +0.j, -0.70710677+0.j],       dtype=complex64)]

epr pairs state vectors

pq_engine.matricies.hadamard_matrix = array([[ 0.70710677+0.j,  0.70710677+0.j],        [ 0.70710677+0.j, -0.70710677+0.j]], dtype=complex64)

hadamard matrix

pq_engine.matricies.minus_state_matrix = array([[ 0.49999997+0.j, -0.49999997+0.j],        [-0.49999997+0.j,  0.49999997+0.j]], dtype=complex64)

|-><-|

pq_engine.matricies.minus_state_vector = array([ 0.70710677+0.j, -0.70710677+0.j], dtype=complex64)

|->

pq_engine.matricies.not_matrix = array([[0.+0.j, 1.+0.j],        [1.+0.j, 0.+0.j]], dtype=complex64)

not matrix

pq_engine.matricies.one_state_matrix = array([[0.+0.j, 0.+0.j],        [0.+0.j, 1.+0.j]], dtype=complex64)

|1><1|

pq_engine.matricies.one_state_vector = array([0.+0.j, 1.+0.j], dtype=complex64)

|1>

pq_engine.matricies.pauli_x_matrix = array([[0.+0.j, 1.+0.j],        [1.+0.j, 0.+0.j]], dtype=complex64)

σ_x

pq_engine.matricies.pauli_y_matrix = array([[ 0.+0.j, -0.-1.j],        [ 0.+1.j,  0.+0.j]], dtype=complex64)

σ_y

pq_engine.matricies.pauli_z_matrix = array([[ 1.+0.j,  0.+0.j],        [ 0.+0.j, -1.+0.j]], dtype=complex64)

σ_z

pq_engine.matricies.plus_state_matrix = array([[0.49999997+0.j, 0.49999997+0.j],        [0.49999997+0.j, 0.49999997+0.j]], dtype=complex64)

|+><+|

pq_engine.matricies.plus_state_vector = array([0.70710677+0.j, 0.70710677+0.j], dtype=complex64)

|+>

pq_engine.matricies.zero_state_matrix = array([[1.+0.j, 0.+0.j],        [0.+0.j, 0.+0.j]], dtype=complex64)

|0><0|

pq_engine.matricies.zero_state_vector = array([1.+0.j, 0.+0.j], dtype=complex64)

|0>

pq_engine.observable module

class pq_engine.observable.Observable(matrix: ndarray)

Bases: object

observable

matrix

representation matrix

Type:

xp.ndarray

observe(state: State) float

observe target system with given state

Parameters:

state (State) – state of target system

Returns:

observed value

Return type:

float

pq_engine.settings module

pq_engine.settings.atol = 1e-05

atol value used by numpy or cupy.

pq_engine.settings.rounded_decimal = 8

approximation order of decimal used by numpy or cupy

pq_engine.settings.rtol = 1e-05

rtol value used by numpy or cupy.

pq_engine.settings.xp: Any = <module 'numpy' from '/home/runner/.cache/pypoetry/virtualenvs/pq-engine-YFEFS7qb-py3.11/lib/python3.11/site-packages/numpy/__init__.py'>

calculation engine (numpy or cupy)

pq_engine.state module

class pq_engine.state.State(matrix: ndarray)

Bases: object

state

matrix

representation matrix

Type:

xp.ndarray

reduce(target: int, structure: list[int])

reduce state by partial trace

Parameters:
  • target (int) – reduction target index

  • sttucture (list[int]) – dimensions with partial systems

pq_engine.time_evolution module

class pq_engine.time_evolution.TimeEvolution(matrix: ndarray)

Bases: object

time evolution

matrix

representation matrix

Type:

xp.ndarray

time_evolve(state: State) None

time evolve target state

Parameters:

state (State) – target state

pq_engine.utils module

pq_engine.utils.check_density(matrix: ndarray) None

check matrix is density

Parameters:

matrix (xp.ndarray) – target matrix

pq_engine.utils.check_hermite(matrix: ndarray) None

check matrix is hermite

Parameters:

matrix (xp.ndarray) – target matrix

pq_engine.utils.check_one_trace(matrix: ndarray) None

check trace of matrix is one

Parameters:

matrix (xp.ndarray) – target matrix

pq_engine.utils.check_square(matrix: ndarray) None

check matrix is square

Parameters:

matrix (xp.ndarray) – target matrix

pq_engine.utils.check_unitary(matrix: ndarray) None

check matrix is unitary

Parameters:

matrix (xp.ndarray) – target matrix

Module contents

Indices and tables