Skip to content

Commit

Permalink
chore: adding entropies
Browse files Browse the repository at this point in the history
[Documentation]

adding entropies, entrpoies is a measure of the amount of randomness or
uncertainty ins tate of a quantum system.
- creating quantum system
  the code creates a complex matrix `rho` representing a quantum state
  using predefined state `st.pb00`, the state is likely defined in the
  include `clarah.h` header
- partial trace calculation
  the `ptrace()` function is used to compute the partial trace of the
  quantums state `rho` over subsystem B. the result stored in the matrix
  `rhoA`
- displaying states
  the `disp()` function is used to display the original quantum state
  matrix `rho` and the result of the partial trace `rhoA`
- entropy calculation
  the `tsallis()` function is used to calculate the tsallis-1 and
  tsallis-2 entropies for the quantum matrix `rho`. the calculated
  entropies displayed
- quantum mutual information calculation
  teh `qmutualinformation()` function to calculation the quantum mutual
  information between subsystem A and B the quantum state `rho`. the
  calculated mutual information is displayed

Signed-off-by: slowy07 <[email protected]>
  • Loading branch information
slowy07 committed Aug 22, 2023
1 parent ae8c6dd commit 18f43af
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Description

<!-- explain the changes -->

### checklist

- [ ] Have you followed the project's coding style guidelines?
- [ ] Have you added unit tests to cover your changes?
- [ ] Have you updated the documentation to reflect your changes?
- [ ] Have you reviewed your changes carefully?
27 changes: 27 additions & 0 deletions testing/entropies.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <iostream>

#include "../include/clara.h"

using namespace clara;

int main() {
// create complex matrix `rho` using the predefined st.pb00 state
cmat rho = st.pb00;

// compute the partial trace over subsystem B and store it in `rhoA`
cmat rhoA = ptrace(rho, {1});
// display the original state matrix
std::cout << "State: " << std::endl << disp(rho) << std::endl;
// display the partial trace result
std::cout << "Partial Trace over B:" << std::endl << disp(rhoA) << std::endl;

// calculate and display von Neumann entropy of the partial trace result
std::cout << "von-neumann entropy: " << entropy(rhoA) << std::endl;
// calculate and display Tsallis-1 entropy for the given state matrix `rho`
std::cout << "Tsallis-1 entropy: " << tsallis(rho, 1) << std::endl;
// calculate and display Tsallis-2 entropy for the given state matrix `rho`
std::cout << "Tsallis-2 entropy: " << tsallis(rho, 2) << std::endl;
// calculate and display quantum mutual information between subsystem A and B
std::cout << "Quantum mutual information Between A and B: " << qmutualinfo(rho, {0}, {1})
<< std::endl;
}

0 comments on commit 18f43af

Please sign in to comment.