27 #ifndef ENTANGLEMENT_H_
28 #define ENTANGLEMENT_H_
45 template<
typename Derived>
47 const std::vector<idx>& dims)
82 template<
typename Derived>
101 std::vector<idx> dims(N, d);
114 template<
typename Derived>
116 const std::vector<idx>& dims)
126 if (dims.size() != 2)
149 template<
typename Derived>
167 std::vector<idx> dims(N, d);
180 template<
typename Derived>
182 const std::vector<idx>& dims)
192 if (dims.size() != 2)
217 template<
typename Derived>
235 std::vector<idx> dims(N, d);
251 template<
typename Derived>
253 const std::vector<idx>& dims)
263 if (dims.size() != 2)
275 std::vector<double> result;
277 for (
idx i = 0; i < static_cast<idx>(scf.rows()); ++i)
278 result.push_back(std::pow(scf(i), 2));
294 template<
typename Derived>
312 std::vector<idx> dims(N, d);
328 template<
typename Derived>
330 const std::vector<idx>& dims)
340 if (dims.size() != 2)
366 template<
typename Derived>
384 std::vector<idx> dims(N, d);
401 template<
typename Derived>
419 if (d * d != static_cast<idx>(rA.rows()))
425 return d * std::abs(std::exp(2. / d *
logdet(
reshape(rA, d, d))));
435 template<
typename Derived>
437 const std::vector<idx>& dims)
447 if (dims.size() != 2)
469 template<
typename Derived>
487 std::vector<idx> dims(N, d);
499 template<
typename Derived>
501 const std::vector<idx>& dims)
511 if (dims.size() != 2)
524 return std::log2(2 *
negativity(rA, dims) + 1);
534 template<
typename Derived>
552 std::vector<idx> dims(N, d);
563 template<
typename Derived>
586 *
kron(sigmaY, sigmaY)).real();
588 std::vector<double> lambdas_sorted(lambdas.data(),
589 lambdas.data() + lambdas.size());
591 std::sort(std::begin(lambdas_sorted), std::end(lambdas_sorted),
592 std::greater<double>());
593 std::transform(std::begin(lambdas_sorted), std::end(lambdas_sorted),
594 std::begin(lambdas_sorted), [](
double elem)
596 return std::sqrt(std::abs(elem));
600 lambdas_sorted[0] - lambdas_sorted[1] - lambdas_sorted[2]
601 - lambdas_sorted[3]);
bool check_nonzero_size(const T &x) noexcept
Definition: util.h:127
Derived::Scalar logdet(const Eigen::MatrixBase< Derived > &A)
Logarithm of the determinant.
Definition: functions.h:173
std::vector< double > schmidtprobs(const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims)
Schmidt probabilities of the bi-partite pure state A.
Definition: entanglement.h:252
bool check_cvector(const Eigen::MatrixBase< Derived > &A)
Definition: util.h:120
double gconcurrence(const Eigen::MatrixBase< Derived > &A)
G-concurrence of the bi-partite pure state A.
Definition: entanglement.h:402
double lognegativity(const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims)
Logarithmic negativity of the bi-partite mixed state A.
Definition: entanglement.h:500
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > dyn_mat
Dynamic Eigen matrix over the field specified by Scalar.
Definition: types.h:78
bool check_dims_match_mat(const std::vector< idx > &dims, const Eigen::MatrixBase< Derived > &A)
Definition: util.h:156
Quantum++ main namespace.
Definition: codes.h:30
idx get_num_subsys(idx sz, idx d)
Definition: util.h:370
double schatten(const Eigen::MatrixBase< Derived > &A, double p)
Schatten matrix norm.
Definition: functions.h:826
cmat svdU(const Eigen::MatrixBase< Derived > &A)
Left singular vectors.
Definition: functions.h:494
cmat schmidtA(const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims)
Schmidt basis on Alice side.
Definition: entanglement.h:115
dyn_col_vect< double > svals(const Eigen::MatrixBase< Derived > &A)
Singular values.
Definition: functions.h:470
dyn_mat< typename T::Scalar > kron(const T &head)
Kronecker product.
Definition: functions.h:895
double entropy(const Eigen::MatrixBase< Derived > &A)
von-Neumann entropy of the density matrix A
Definition: entropies.h:43
Generates custom exceptions, used when validating function parameters.
Definition: exception.h:39
dyn_mat< typename Derived::Scalar > transpose(const Eigen::MatrixBase< Derived > &A)
Transpose.
Definition: functions.h:44
dyn_col_vect< cplx > evals(const Eigen::MatrixBase< Derived > &A)
Eigenvalues.
Definition: functions.h:304
idx get_dim_subsys(idx sz, idx N)
Definition: util.h:378
dyn_mat< typename Derived::Scalar > conjugate(const Eigen::MatrixBase< Derived > &A)
Complex conjugate.
Definition: functions.h:64
bool check_square_mat(const Eigen::MatrixBase< Derived > &A)
Definition: util.h:99
cmat schmidtB(const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims)
Schmidt basis on Bob side.
Definition: entanglement.h:181
cmat svdV(const Eigen::MatrixBase< Derived > &A)
Right singular vectors.
Definition: functions.h:519
double entanglement(const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims)
Entanglement of the bi-partite pure state A.
Definition: entanglement.h:329
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > dyn_col_vect
Dynamic Eigen column vector over the field specified by Scalar.
Definition: types.h:90
static const Gates & get_instance() noexcept(std::is_nothrow_constructible< const Gates >::value)
Definition: singleton.h:90
dyn_mat< typename Derived::Scalar > ptranspose(const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &subsys, const std::vector< idx > &dims)
Partial transpose.
Definition: operations.h:1540
Eigen::MatrixXcd cmat
Complex (double precision) dynamic Eigen matrix.
Definition: types.h:61
std::size_t idx
Non-negative integer index.
Definition: types.h:36
double concurrence(const Eigen::MatrixBase< Derived > &A)
Wootters concurrence of the bi-partite qubit mixed state A.
Definition: entanglement.h:564
cmat Y
Pauli Sigma-Y gate.
Definition: gates.h:46
dyn_col_vect< double > schmidtcoeffs(const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims)
Schmidt coefficients of the bi-partite pure state A.
Definition: entanglement.h:46
dyn_mat< typename Derived::Scalar > reshape(const Eigen::MatrixBase< Derived > &A, idx rows, idx cols)
Reshape.
Definition: functions.h:1135
double negativity(const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims)
Negativity of the bi-partite mixed state A.
Definition: entanglement.h:436