quairkit.qinfo.check¶
- quairkit.qinfo.check.is_choi(op)¶
- Check if the input op is a Choi operator of a physical operation.
Support batch input.
- Parameters:¶
- op : ndarray | Tensor¶
matrix form of the linear operation.
- Returns:¶
Whether the input op is a valid quantum operation Choi operator. For batch input, return a boolean array with the same batch dimensions as input.
- Return type:¶
bool | List[bool]
Note
The operation op is (default) applied to the second system.
-
quairkit.qinfo.check.is_density_matrix(rho, eps=
1e-06
)¶ - Verify whether
rho
is a legal quantum density matrix Support batch input
- Verify whether
-
quairkit.qinfo.check.is_hermitian(mat, eps=
1e-06
)¶ - Verify whether
mat
is Hermitian. Support batch input.
- Verify whether
-
quairkit.qinfo.check.is_linear(func, info, input_dtype=
None
, eps=1e-05
)¶ Check if the provided function ‘func’ is linear.
- Parameters:¶
- func : Callable[[Tensor | ndarray], Tensor | ndarray]¶
A callable function to be tested. This function should accept and return either a torch.Tensor or a numpy.ndarray.
- info : List[int] | Callable[[], ndarray] | Callable[[], Tensor]¶
A parameter specifying the shape of the input for ‘func’. It can be a list of two integers (defining the shape of a tensor), a callable that returns a numpy.ndarray, or a callable that returns a torch.Tensor.
- eps : float | None¶
An optional tolerance value used to determine if the function’s behavior is close enough to linear. Default value is 1e-6.
- Returns:¶
True if ‘func’ behaves as a linear function within the specified tolerance ‘eps’; False otherwise.
- Return type:¶
bool
- Raises:¶
TypeError – If ‘func’ is not callable, does not accept a torch.Tensor or numpy.ndarray as input, or does not return a torch.Tensor or numpy.ndarray. If ‘info’ is not a valid type (not a list of integers or a callable returning a torch.Tensor or numpy.ndarray).
-
quairkit.qinfo.check.is_positive(mat, eps=
1e-06
)¶ - Verify whether
mat
is a positive semi-definite matrix. Support batch input.
- Verify whether
-
quairkit.qinfo.check.is_povm(set_op, eps=
1e-06
)¶ Check if a set of operators forms a positive operator-valued measure (POVM).
-
quairkit.qinfo.check.is_projector(mat, eps=
1e-06
)¶ - Verify whether
mat
is a projector. Support batch input.
- Verify whether
- quairkit.qinfo.check.is_ppt(density_op)¶
- Check if the input quantum state is PPT.
Support batch input.
-
quairkit.qinfo.check.is_pvm(set_op, eps=
1e-06
)¶ Check if a set of operators forms a projection-valued measure (PVM).
-
quairkit.qinfo.check.is_state_vector(vec, eps=
1e-06
)¶ - Verify whether
vec
is a legal quantum state vector. Support batch input.
- Verify whether