Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #5

Merged
merged 84 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
754a885
docs: adding documentation
slowy07 Jul 15, 2023
bdcc821
docs: adding documentation
slowy07 Jul 16, 2023
b21993f
chore(test): adding run_test interactive to github action
slowy07 Jul 16, 2023
eeb7a50
fix: fixing directories
slowy07 Jul 16, 2023
c6a4a9c
fix: fixing directories
slowy07 Jul 16, 2023
f96ab26
chroe: ``evects`` function (#1)
khairanabila Jul 16, 2023
81a8aaa
chore(add): adding more information and unitest
slowy07 Jul 17, 2023
f77e840
fix: fix interpreter
slowy07 Jul 17, 2023
e900dfe
fix: fix interpreter
slowy07 Jul 17, 2023
f13be23
chore(feat): improvement exception function call
slowy07 Jul 21, 2023
ae4feab
chore(feat): update ``testing/_test.cpp``
slowy07 Jul 21, 2023
bad07d9
chore(feat): update ``testing/grover_search.cpp``
slowy07 Jul 22, 2023
358b33c
chore(attemp: 1): testing grover search and testing channels
slowy07 Jul 22, 2023
bf3af3d
docs: adding documentation
slowy07 Jul 22, 2023
5be026c
chore: test macos environment (#3)
khairanabila Jul 23, 2023
50aae54
fix: typo spelling run
slowy07 Jul 23, 2023
ce0a334
fix: header fix test on macOS clara
slowy07 Jul 23, 2023
1b897fe
fix: header fix test on macOS clara
slowy07 Jul 23, 2023
1b13dd8
fix: header fix test on macOS clara
slowy07 Jul 23, 2023
f13e192
fix: header fix test on macOS clara
slowy07 Jul 23, 2023
17300a9
fix: header fix test on macOS clara
slowy07 Jul 23, 2023
458eee6
fix: header fix test on macOS clara
slowy07 Jul 23, 2023
7b98ffc
fix: remove temporary macos
slowy07 Jul 23, 2023
8327109
feat: add testing with docker image
rulanugrh Jul 28, 2023
4269c26
docs: update Documentation
slowy07 Jul 31, 2023
00c50b2
docs: update Documentation
slowy07 Jul 31, 2023
164e790
chore: adding docker testing
slowy07 Jul 31, 2023
02a6ca4
Merge branch 'development' of https://github.com/slowy07/clara into d…
slowy07 Jul 31, 2023
54dfcfc
fix: identation action test
slowy07 Jul 31, 2023
c15c3cf
chore: adding operation testing
slowy07 Jul 31, 2023
615b878
chore: trying update code with macOS test clara
slowy07 Jul 31, 2023
152fe86
fix: environment changes
slowy07 Jul 31, 2023
44b519d
fix: try use xcode --install
slowy07 Jul 31, 2023
4e5006b
fix: try use xcode --install
slowy07 Jul 31, 2023
fd6b7eb
fix: fixing cmake
slowy07 Jul 31, 2023
43e85ba
fix: testing timer
slowy07 Jul 31, 2023
04f7144
fix: testing timer
slowy07 Jul 31, 2023
4dcae5a
fix: testing timer
slowy07 Jul 31, 2023
6822dc0
docs: update documentation
slowy07 Jul 31, 2023
5f87806
docs: adding more documentation
slowy07 Aug 2, 2023
34a6be6
chore: testing adding action environment windows test
slowy07 Aug 3, 2023
89a5639
fix: test with specific command to test on windows
slowy07 Aug 3, 2023
6428c16
fix: test rmdir to rd
slowy07 Aug 3, 2023
4baa0e3
fix: test rd to rmdir with shell powershell
slowy07 Aug 3, 2023
a429456
fix: test to adding path from eigen was installed
slowy07 Aug 3, 2023
0392ebe
fix: testing env github action path setting eigen
slowy07 Aug 3, 2023
7e350a0
fix: testing env github action path setting eigen
slowy07 Aug 3, 2023
13347d1
fix: attemp fixing on directory command
slowy07 Aug 3, 2023
975e069
fix: try to adding cmake list for windows
slowy07 Aug 3, 2023
f3e5e36
fix: typo
slowy07 Aug 3, 2023
f53e2a0
fix: call cmake
slowy07 Aug 3, 2023
44ee71a
fix: call cmake
slowy07 Aug 3, 2023
2372046
fix: call cmake
slowy07 Aug 3, 2023
b389a7b
fix: call cmake
slowy07 Aug 3, 2023
f70f221
fix: remove windows test and adding on arch latest
slowy07 Aug 3, 2023
48430b8
fix: adding
slowy07 Aug 3, 2023
cbf5c59
fix: adding separate the install test
slowy07 Aug 3, 2023
7fc1eb3
fix: adding arch based by separated the test
slowy07 Aug 3, 2023
a46eb5b
fix: adding arch based by separated the test
slowy07 Aug 3, 2023
a558f5b
chore: update shell test
slowy07 Aug 4, 2023
b46e154
fix: rename testing filename
slowy07 Aug 5, 2023
1bb72d7
chore: testing GPU support install
slowy07 Aug 7, 2023
35ec562
chore: attemp (1) test gpu CUDA
slowy07 Aug 7, 2023
ea40b0b
chore: attemp (2) test gpu CUDA
slowy07 Aug 7, 2023
189bd37
chore: attemp (3) test base on windows
slowy07 Aug 7, 2023
f4c4701
chore: attemp (4) test base on windows
slowy07 Aug 7, 2023
01b8ca0
chore: attemp (5) test base on windows
slowy07 Aug 7, 2023
c6ecdbc
chore: attemp (6) test base on windows
slowy07 Aug 7, 2023
705b872
chore: attemp (7) test base on windows
slowy07 Aug 7, 2023
0e5a02b
fix: fixing CWE-120, CWE-20
slowy07 Aug 7, 2023
bda75ac
docs: adding documentation code
slowy07 Aug 8, 2023
365ae9b
fix: testing timer
slowy07 Aug 8, 2023
81fd7ea
chore: more upgrade stuff
slowy07 Aug 10, 2023
64744bc
chore: add quantum operation
slowy07 Aug 11, 2023
764cf7a
docs: adding documentation on ``functions.h``
slowy07 Aug 16, 2023
443601b
chore: adding quantum fourier transform
slowy07 Aug 19, 2023
9d42922
.git/refs/COMMIT_EDITMSG
slowy07 Aug 21, 2023
cd5ecce
fix: remove testing shoutOperator
slowy07 Aug 21, 2023
cca7da7
fix: adding preprocessor directive to catch macos
slowy07 Aug 21, 2023
ae8c6dd
docs: adding CONTRIBUTING
slowy07 Aug 22, 2023
18f43af
chore: adding entropies
slowy07 Aug 22, 2023
f222f51
chore: adding quantum circuit simulation
slowy07 Sep 4, 2023
1b00299
fix: remove unused header
slowy07 Dec 27, 2023
f17f53d
Merge branch 'main' into development
slowy07 Dec 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/clara.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <utility>
#include <vector>

#include <Eigen/Dense>
#include <Eigen/SVD>
// inter dependicies
#include "classFunction/codes.h"
#include "classFunction/exception.h"
Expand Down
106 changes: 9 additions & 97 deletions testing/_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <random>
#include <vector>

#include "../include/clara.h"
#include "../include/experimental/experimental_test.h"

/**
Expand All @@ -18,101 +17,14 @@
*/

using namespace clara;
using namespace::experimental;
int main() {
std::cout << "testing testing \n";

// initialize bit circuit with 70 bits
const idx bits = 70;
experimental::Bit_circuit b{bits};

const idx trials = 20;

// number of trials
b.rand();
auto c = b;

/**
* random number generator `gen` is set up using
* random_device for generating random indices. for each trial
* vector `v` is filled wuth values from `0` to `bits-1`. the element
* of `v` represent the indices of the `TOF` (Toffoli) operation. these indices
* are store for later use in trials
*/
std::random_device rd;
std::mt19937 gen{rd()};
std::vector<std::vector<idx>> indices(trials);

for (idx i = 0; i < trials; ++i) {
std::vector<idx> v(bits);
std::iota(v.begin(), v.end(), 0);
std::shuffle(v.begin(), v.end(), gen);
std::vector<idx> tof(v.data(), v.data() + 3);
indices[i] = tof;
}

/**
* the first half of the trials is performed. the indices for each trials are
* printed, and the `TOF` operations is applied to the `Bit_circuit` using
* corresponding indices
*/
for (idx i = 0; i < trials; ++i) {
std::cout << "first: ";
for (auto&& elem : indices[i])
std::cout << elem << " ";
std::cout << std::endl;
b.TOF(indices[i]);
}

/**
* the second half of the trials performed in reverse order. the indices for each
* trial are again printed, and the `TOF` operation is applied to the `Bit_circuit`
* using the corresponding indices
*/
for (idx i = trials; i-- > 0;) {
std::cout << "second: ";
for (auto&& elem : indices[i])
std::cout << elem << " ";
std::cout << std::endl;
b.TOF(indices[i]);
}

/**
* the initail and final state are printed. the hamming weight (number of set bits)
* of `b` is displayed. the count of NOT, X and TOF gates used in `b` is printed
*/
std::cout << "initial: " << b << std::endl;
std::cout << "final: " << c << std::endl;
std::cout << "hamming weight: " << b.count() << std::endl;

std::cout << b.gate_count.NOT << " " << b.gate_count.X << " " << b.gate_count.TOF << std::endl;
std::cout << (b == c) << std::endl;
std::cout << (b != c) << std::endl;

/**
* various quantum states and projections are created and printed
*/
experimental::Dynamic_bitset bb(9);
bb.set(1).set(3).set(8);
std::cout << bb << std::endl;

std::cout << "info: " << std::endl;
std::cout << bb.to_string('o', 'X') << std::endl;

experimental::Dynamic_bitset vlad(20);
std::cout << vlad << std::endl;

std::vector<unsigned int> vv(20);
for (auto& elem : vv) {
std::cout << elem;
}
std::cout << std::endl;

ket x = (10_ket + 01_ket) / std::sqrt(2);
std::cout << disp(x) << std::endl;

bra y = (10_bra + 01_bra) / std::sqrt(2);
std::cout << disp(x) << std::endl;

cmat z = 110_prj;
std::cout << disp(z) << std::endl;
ClaraCircuit<int> claraCircuit(10, 10);
claraCircuit.apply_all(gt.H);
std::cout << claraCircuit.get_num_active_qubits() << std::endl;

claraCircuit.measure({3, 1, 7});
std::cout << claraCircuit.get_num_active_qubits() << std::endl;
// std::cout << claraCircuit.get_num_measured_qubits() << std::endl;
// std::cout << claraCircuit.get_num_active_qubits() << std::endl;
}
46 changes: 23 additions & 23 deletions testing/channels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,27 @@ int main() {

std::cout << "their sum is: " << sum(hevals(choim)) << "\n";

std::vector<cmat> Kperps = choi2kraus(choim);
std::cout << "kraus rank of channel : " << Kperps.size() << "\n";

cmat rho_out1 = clara::apply(rho_in, Kperps);
// verification norm difference
std::cout << "norm difference ouput states: " << norm(rho_out1 - rho_out) << "\n";

std::cout << "superoperator matrix:\n";
cmat smat = kraus2super(Ks);
std::cout << disp(smat) << "\n";

std::cout << "the eigenvalues of the superoperator matrix :\n";
dyn_col_vect<cplx> evalsupop = evals(smat);
std::cout << disp(transpose(evalsupop)) << "\n";

std::cout << "their absolute values are: \n";
for (idx i = 0; i < (idx)evalsupop.size(); ++i)
std::cout << std::abs(evalsupop(i)) << " ";

// verification
std::cout << "\n norm difference for the superoperator action: ";
cmat rho_out2 = transpose(reshape(smat * reshape(transpose(rho_in), D * D, 1), D, D));
std::cout << norm(rho_out - rho_out2) << "\n";
// std::vector<cmat> Kperps = choi2kraus(choim);
// std::cout << "kraus rank of channel : " << Kperps.size() << "\n";
//
// cmat rho_out1 = clara::apply(rho_in, Kperps);
// // verification norm difference
// std::cout << "norm difference ouput states: " << norm(rho_out1 - rho_out) << "\n";
//
// std::cout << "superoperator matrix:\n";
// cmat smat = kraus2super(Ks);
// std::cout << disp(smat) << "\n";
//
// std::cout << "the eigenvalues of the superoperator matrix :\n";
// dyn_col_vect<cplx> evalsupop = evals(smat);
// std::cout << disp(transpose(evalsupop)) << "\n";
//
// std::cout << "their absolute values are: \n";
// for (idx i = 0; i < (idx)evalsupop.size(); ++i)
// std::cout << std::abs(evalsupop(i)) << " ";
//
// // verification
// std::cout << "\n norm difference for the superoperator action: ";
// cmat rho_out2 = transpose(reshape(smat * reshape(transpose(rho_in), D * D, 1), D, D));
// std::cout << norm(rho_out - rho_out2) << "\n";
}