class QPanda::MPSImplQPU

Overview

QPU implementation by MPS model. More...

Inherited Members

Detailed Documentation

QPU implementation by MPS model.

Fields

the tensor of qubits.

lambdas between tensors.

Methods

init state from matrix

Parameters:

size_t number of qubits
cmatrix_t matrix

unitary single qubit gate

Parameters:

size_t qubit address
QStat& matrix
bool state of conjugate
GateType gate type

Returns:

QError

controlunitary single qubit gate

Parameters:

size_t qubit address
Qnum& control qubit addresses
QStat & matrix
bool state of conjugate
GateType gate type

Returns:

QError

unitary double qubit gate

Parameters:

size_t first qubit address
size_t second qubit address
QStat& matrix
bool state of conjugate
GateType gate type

Returns:

QError

controlunitary double qubit gate

Parameters:

size_t first qubit address
size_t second qubit address
Qnum& control qubit addresses
QStat& quantum states
bool state of conjugate
GateType gate type

Returns:

QError

get quantum states

Returns:

QStat quantum states

reset qubit

Parameters:

size_t qubit address

gets the position of the qubits in MPS form

Parameters:

size_t qubits index

Returns:

size_t the position on m_qubits_location

change two qubits

Parameters:

size_t src qubit location
size_t dst qubit location

execute SWAP gate, the state of swapping two qubits

Parameters:

size_t A qubit index
size_t B qubit index

measure one qubit collapsing

Parameters:

size_t the qubit position of the measurement

Returns:

bool the measurement results

measure all qubits collapsing

Parameters:

size_t the qubit position of the measurement

Returns:

std::vector<std::vector<size_t>> the measurement results

after the SVD decomposition , The product of S and V

Parameters:

cmatrix_t V matrix
rvector_t S vector

Returns:

cmatrix_t product

convert to MPS form

Parameters:

size_t starting position
size_t end position

Returns:

MPS_Tensor MPS form tensor

sort qubits location, and centralize qubits locations

Parameters:

Qnum original qubits location
Qnum sorted indices
Qnum centralized qubits location

move all qubits to sorted ordering

move qubits to right_end location

Parameters:

Qnum original qubits location
Qnum target qubits location
actual indices

execute one qubit gate

Parameters:

size_t target qubit
cmatrix_t gate matrix

execute two qubits gate

Parameters:

size_t control qubit
size_t target qubit
cmatrix_t gate matrix

execute multi qubits gate

Parameters:

size_t control and target qubits, target qubit in the tail
cmatrix_t gate matrix