Package: thqml
ThQML: Thinking Quantum Machine learningC. ContiCode for the book Quantum Machine Learning,https://doi.org/10.1007/978-3-031-44226-1Being free of any licensing fees, ThQML is ideal for exploring quantum machine learning for students and researchers.Created by followinghttps://packaging.python.org/en/latest/tutorials/packaging-projects/Requirementsgraphvizhttps://graphviz.gitlab.io/downloadfor plot_model to workInstallationLocal installation.
The use may eventually use acondaor similar environment.In the downloaded folder from githubpython3-mpipinstall.Note the dot at the endTo install an editable versionpython3-mpipinstall-e.Note the dot after editableCiting ThQMLIf you use ThQML in your research, please cite the book
See the references inthqml.bibLast test with code versions (september 2023)tensorflow 2.11.0matplotlib 3.7.2numpy 1.24.3Tree.
├── CODE_OF_CONDUCT.md
├── jupyternotebooks
│   ├── bosonsampling
│   │   ├── BosonSamplingExample1.ipynb
│   │   ├── BosonSamplingExample2.ipynb
│   │   ├── BosonSamplingExample3.ipynb
│   │   ├── BosonSamplingExample4b.ipynb
│   │   ├── BosonSamplingExample4.ipynb
│   │   ├── BosonSamplingExample5.ipynb
│   │   ├── BosonSamplingExample6.ipynb
│   │   ├── BosonSamplingExample7.ipynb
│   │   ├── BosonSamplingExample8.ipynb
│   │   └── BosonSamplingExample9.ipynb
│   ├── logo_circular.png
│   ├── phasespace
│   │   ├── beamsplitter.ipynb
│   │   ├── BellBS.ipynb
│   │   ├── coherentcomplex.ipynb
│   │   ├── coherentcomplextrainingCOV.ipynb
│   │   ├── coherentcomplextrainingDER.ipynb
│   │   ├── coherentcomplextraining.ipynb
│   │   ├── coherent.ipynb
│   │   ├── differentiallayer.ipynb
│   │   ├── phasemodulator.ipynb
│   │   ├── photoncountinglayer.ipynb
│   │   ├── singlemodesqueezerBS.ipynb
│   │   ├── singlemodesqueezer.ipynb
│   │   ├── symplectic.ipynb
│   │   ├── testGaussianLayer.ipynb
│   │   ├── twolayersreservoir.ipynb
│   │   ├── twomodesqueezer.ipynb
│   │   └── uncertainty.ipynb
│   ├── quantumfeaturemap
│   │   ├── coherentstate.ipynb
│   │   ├── kernelexample.ipynb
│   │   ├── QAOATwoQubitTransverseFieldIsing.ipynb
│   │   ├── QuantumKernelMachineQubits.ipynb
│   │   ├── QuantumNeuralStateTwoQubitTransverseFieldIsing.ipynb
│   │   ├── QubitsDensityMatrix.ipynb
│   │   ├── QubitsGym.ipynb
│   │   ├── QubitsMap.ipynb
│   │   ├── SingleQubitTransverseFieldIsing.ipynb
│   │   ├── squeezedvacuum.ipynb
│   │   ├── TensorsAndVectors.ipynb
│   │   └── TwoQubitTransverseFieldIsing.ipynb
│   └── soliton
│       ├── BoseHubbardNNT.ipynb
│       ├── BoseHubbardTwinNNT.ipynb
│       ├── BoseHubbardTwinNNTVersusN.ipynb
│       ├── modelSingleSoliton.png
│       └── modelTwin.png
├── LICENSE.txt
├── mathematica
│   ├── noncommutative.nb
│   ├── SingleQubitTransverseIsing.nb
│   ├── SingleQubitTransverseIsing.pdf
│   ├── tensorgaussian.nb
│   ├── TwoQubitTransverseIsing.nb
│   └── TwoQubitTransverseIsing.pdf
├── matlabsymbolic
│   ├── beamsplitter.m
│   ├── entanglementBS.m
│   ├── plot_entanglement_BS.m
│   ├── RqRpJ.m
│   ├── squeezedoperator.m
│   ├── test_RqRp.m
│   └── twomodesqueezedoperator.m
├── pyproject.toml
├── README.md
├── thqml
│   ├── EntangledFeatureMap.py
│   ├── __init__.py
│   ├── phasespace.py
│   ├── quantummap.py
│   ├── quantumsolitons.py
│   └── utilities.py
└── thqml.bibDocumentationSee the book Quantum Machine LearningCode per chapterChapter 1jupyternotebooks/quantumfeaturemap/kernelexample.ipynbPage 13
Example of generation of dataset and withscikit-leanChapter 2jupyternotebooks/quantumfeaturemap/coherentstate.ipynbPage 33
Feature mapping by coherent statejupyternotebooks/quantumfeaturemap/squeezedvacuum.ipynbpage 38
feature mapping by squeezed stateChapter 3jupyternotebooks/quantumfeaturemap/QubitsMap.ipynbpage 52
defining Qubits in TensorFlowjupyternotebooks/quantumfeaturemap/TensorsAndVectors.ipynbpage 56
defining and manipulating tensors and vectorsthqml/quantummap.pypage 61
main library with qubit functionsjupyternotebooks/quantumfeaturemap/QubitsMap.ipynbpage 61 (continue)
qubits feature mappingjupyternotebooks/quantumfeaturemap/QubitsGym.ipynbpage 64
more on qubits and tensorsthqml/quantummap.pypage 68 (continue)
main library with qubit functionsjupyternotebooks/quantumfeaturemap/QubitsMap.ipynbpage 74 (continue)
qubits feature mappingjupyternotebooks/quantumfeaturemap/QuantumKernelMachineQubits.ipynbpage 79
quantum kernel machine with qubitsChapter 4jupyternotebooks/quantumfeaturemap/SingleQubitTransverseFieldIsing.ipynbpage 89
Transverse Field Ising Model with a Single Qubitmathematica/SingleQubitTransverseIsing.nbMATHEMATICApage 90
Analytical results on the single qubit transverse field Ising modeljupyternotebooks/quantumfeaturemap/SingleQubitTransverseFieldIsing.ipynbpage 92 (continue)
Transverse Field Ising Model with a Single Qubitjupyternotebooks/quantumfeaturemap/SingleQubitTransverseFieldIsing.ipynbpage 99 (continue)
Transverse Field Ising Model with a Single QubitChapter 5mathematica/TwoQubitTransverseIsing.nbMATHEMATICApage 104
Analytical results on the two-qubit transverse field Ising modelmathematica/TwoQubitTransverseIsing.nbMATHEMATICApage 105 (continue)
Analytical results on the two-qubit transverse field Ising modeljupyternotebooks/quantumfeaturemap/QubitsDensityMatrix.ipynbpage 114
Computing the density matrix with qubitsjupyternotebooks/quantumfeaturemap/QubitsDensityMatrix.ipynbpage 118 (continue)
Computing the density matrix with qubitsjupyternotebooks/quantumfeaturemap/QubitsDensityMatrix.ipynbpage 132 (continue)
Computing the density matrix with qubitsmathematica/TwoQubitTransverseIsing.nbMATHEMATICApage 133 (continue)
Analytical results on the two-qubit transverse field Ising modelChapter 6jupyternotebooks/quantumfeaturemap/TwoQubitTransverseFieldIsing.ipynbpage 139
Transverse Field Ising Model with Two Qubitjupyternotebooks/quantumfeaturemap/QAOATwoQubitTransverseFieldIsing.ipynbpage 152
Transverse Field Ising Model with Two Qubit with Quantum Approximation Optimization Algorithmjupyternotebooks/quantumfeaturemap/QuantumNeuralStateTwoQubitTransverseFieldIsing.ipynbpage 157
Transverse Field Ising Model with Two Qubit with Quantum Neural StateChapter 7matlabsymbolic/test_Rqpm.mMATLABpage 188
Symbolic relations of projection matricesjupyternotebooks/phasespace/symplectic.ipynbpage 189
Test of projection matrices injupyterthqml/phasespace.pypage 190
main library with phasespace functionsthqml/phasespace.pypage 191 (continue)
main library with phasespace functionsChapter 8thqml/phasespace.pypage 196 (continue)
main library with phasespace functionsthqml/phasespace.pypage 199 (continue)
main library with phasespace functionsjupyternotebooks/phasespace/testGaussianLayer.ipynbpage 199
Test of the Gaussian layerjupyternotebooks/phasespace/testGaussianLayer.ipynbpage 200 (continue)
Test of the Gaussian layerthqml/phasespace.pypage 205 (continue)
main library with phasespace functionsjupyternotebooks/phasespace/coherent.ipynbpage 209
Neural network representation of a coherent statethqml/phasespace.pypage 210 (continue)
main library with phasespace functionsChapter 9jupyternotebooks/phasespace/coherent.ipynbpage 216 (continue)
Neural network representation of a coherent statejupyternotebooks/phasespace/coherentcomplex.ipynbpage 217
Coherent state in a complex mediumjupyternotebooks/phasespace/coherentcomplex.ipynbpage 219 (continue)
Coherent state in a complex mediumjupyternotebooks/phasespace/coherentcomplextraining.ipynbpage 219
Coherent state in a complex medium with trainingjupyternotebooks/phasespace/coherentcomplextraining.ipynbpage 221 (continue)
Coherent state in a complex medium with trainingjupyternotebooks/phasespace/coherentcomplextraining.ipynbpage 222 (continue)
Coherent state in a complex medium with trainingjupyternotebooks/phasespace/coherentcomplextrainingDER.ipynbpage 225
Coherent state in a complex medium with training with derivativesthqml/phasespace.pypage 226 (continue)
main library with phasespace functionsjupyternotebooks/phasespace/coherentcomplextrainingCOV.ipynbpage 227
Coherent state in a complex medium with training with covariancejupyternotebooks/phasespace/twolayersreservoir.ipynbpage 230
Two trainable interferometer and a reservoirthqml/phasespace.pypage 231 (continue)
Main library with phasespace functionsjupyternotebooks/phasespace/phasemodulator.ipynbpage 232
Phase modulator modelChapter 10matlabsymbolic/squeezeoperator.mMATLABpage 237
Matrix representation of the squeeze operator in MATLABjupyternotebooks/phasespace/singlemodesquezer.ipynbpage 237
Single-mode squeezer modelthqml/phasespace.pypage 238 (continue)
Main library with phasespace functionsjupyternotebooks/phasespace/singlemodesquezer.ipynbpage 240 (continue)
Single-mode squeezer modeljupyternotebooks/phasespace/singlemodesquezer.ipynbpage 243 (continue)
Single-mode squeezer modelmatlabsymbolic/squeezeoperator.mMATLABpage 244
Matrix representation of the two-mode squeeze operator in MATLABthqml/phasespace.pypage 245 (continue)
Main library with phasespace functionsjupyternotebooks/phasespace/twomodesquezer.ipynbpage 247
Two-mode squeezer modelmatlabsymbolic/beamsplitter.mMATLABpage 248
Matrix representation of the beam splitter operator in MATLABthqml/phasespace.pypage 248 (continue)
Main library with phasespace functionsjupyternotebooks/phasespace/beamsplitter.ipynbpage 251
Beam splitter modelthqml/phasespace.pypage 251 (continue)
Main library with phasespace functionsjupyternotebooks/phasespace/photoncountinglayer.ipynbpage 252
Example 1 with a photon counting layerjupyternotebooks/phasespace/BellBS.ipynbpage 254
Example 2 with a photon counting layerjupyternotebooks/phasespace/photoncounting.ipynbpage 254
Example 3 with a photon counting layerjupyternotebooks/phasespace/BellBS.ipynbpage 255 (continue)
Example 4 with a photon counting layer and beam splitterChapter 11thqml/phasespace.pypage 263 (continue)
Main library with phasespace functionsjupyternotebooks/phasespace/uncertainty.ipynbpage 264
Example in using Laplacian layer for computing uncertaintythqml/phasespace.pypage 265 (continue)
Main library with phasespace functionsjupyternotebooks/phasespace/uncertainty.ipynbpage 267 (continue)
Example in using Laplacian layer for computing uncertaintythqml/phasespace.pypage 267 (continue)
Main library with phasespace functionsjupyternotebooks/phasespace/uncertainty.ipynbpage 269 (continue)
Example in using Laplacian layer for computing uncertaintyjupyternotebooks/phasespace/uncertainty.ipynbpage 272 (continue)
Example in using Laplacian layer for computing uncertaintymathematica/noncommutative.nbMATHEMATICApage 275
Mathematica example on non commutative operatorsmathematica/tensorgaussian.nbMATHEMATICApage 276
Mathematica example on tensors for Gaussian statesthqml/phasespace.pypage 279 (continue)
Main library with phasespace functionsjupyternotebooks/phasespace/differentiallayer.ipynbpage 282
Example of use of differential layer in computing uncertaintyjupyternotebooks/phasespace/BellBS.ipynbpage 284 (continue)
Example 4 with a photon counting layer and beam splitterjupyternotebooks/phasespace/singlemodesqueezerBS.ipynbpage 287
Model with single mode squeezer and beam splitter with entanglementthqml/phasespace.pypage 287 (continue)
Main library with phasespace functionsChapter 12jupyternotebooks/bosonsamplingexample/BosonSamplingExample1.ipynbpage 305
Example 1 with boson samplingthqml/phasespace.pypage 309 (continue)
Main library with phasespace functionsjupyternotebooks/bosonsamplingexample/BosonSamplingExample1.ipynbpage 310
Example 1 with boson sampling, GBS on single model coherent statejupyternotebooks/bosonsamplingexample/BosonSamplingExample2.ipynbpage 312
Example 2 with boson sampling, GBS on single mode squeezed statejupyternotebooks/bosonsamplingexample/BosonSamplingExample3.ipynbpage 314
Example 3 with boson sampling, GBS on multi-mode (two modes) coherent statesjupyternotebooks/bosonsamplingexample/BosonSamplingExample4.ipynbpage 316
Example 4 with boson sampling, GBS on multi-mode (two modes) squezed and coherent states with transform layerjupyternotebooks/bosonsamplingexample/BosonSamplingExample4b.ipynbpage 316
Example 4b with boson sampling, GBS on multi-mode (two modes) squezed and coherent states with random layerjupyternotebooks/bosonsamplingexample/BosonSamplingExample5.ipynbpage 318
Example 5 with boson sampling, GBS Haar interferometer and multimode squeezed vacuumthqml/phasespace.pypage 319 (continue)
Main library with phasespace functionsjupyternotebooks/bosonsamplingexample/BosonSamplingExample6.ipynbpage 321
Example 6 with boson sampling, GBS Haar interferometer and multimode squeezed vacuumGenerates the following figuresBosonSamplingExample6.pdfmodelHaar.pdfBosonSamplingExample6ALL.pdfjupyternotebooks/bosonsamplingexample/BosonSamplingExample6.ipynbpage 324 (continue)
Example 6 with boson sampling, GBS Haar interferometer and multimode squeezed vacuumjupyternotebooks/bosonsamplingexample/BosonSamplingExample6.ipynbpage 324 (continue)
Example 6 with boson sampling, GBS Haar interferometer and multimode squeezed vacuumjupyternotebooks/bosonsamplingexample/BosonSamplingExample7.ipynbpage 329
Example 7 with boson sampling, GBS Haar and squeezer with training particle numberGenerates the following figuresmodelBS7.pngmodelBS7.pdfBS7pairsnotraining.pdfBS7quaternotraining.pdfBS7ALLnotraining.pdfBS7traininghistory.pdfBS7pairstrained.pdfBS7quatertrained.pdfBS7ALLtrained.pdfjupyternotebooks/bosonsamplingexample/BosonSamplingExample8.ipynbpage 336
Example 8 with boson sampling, GBS Haar and squeezing training particle number and squeezing parametersjupyternotebooks/bosonsamplingexample/BosonSamplingExample9.ipynbpage 336
Example 9 with boson sampling, GBS Haar and squeezing training on differential particle numberChapter 13thqml/quantumsolitons.pypage 348
Library with functions for quantum manybody and solitonsthqml/quantumsolitons.pypage 354 (continue)
Library with functions for quantum manybody and solitonsjupyternotebooks/soliton/BoseHubbardNNT.ipynbpage 356
Model for the ground state of the Bose-Hubbard Hamiltonianthqml/quantumsolitons.pypage 361 (continue)
Library with functions for quantum manybody and solitonsjupyternotebooks/soliton/BoseHubbardTwinNNT.ipynbpage 362
Model Bose-Hubbard Hamiltonian with two solitonsjupyternotebooks/soliton/BoseHubbardTwinNNTVersusN.ipynbpage 362
Model Bose-Hubbard Hamiltonian with two solitons versus N