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

created abstractions for quantum information on qubits #251

Merged
merged 7 commits into from
Jul 27, 2019

Conversation

atombear
Copy link
Contributor

@atombear atombear commented Jun 4, 2019

This is a WIP: I will add (more) tests in the next few days!

@atombear atombear force-pushed the feature/quantum_information_pauli branch 2 times, most recently from 170ab09 to a22c38f Compare June 5, 2019 18:01
@atombear atombear force-pushed the feature/quantum_information_pauli branch from a22c38f to ce25ba7 Compare June 6, 2019 00:11
Copy link

@ampolloreno ampolloreno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atombear I've given a very cursory review since I'm getting up to speed on the library. I'll add more tomorrow, but I thought I'd give you what I've done so far!

src/pauli.jl Show resolved Hide resolved
src/pauli.jl Outdated Show resolved Hide resolved
"""
PauliTransferMatrix(unitary::DenseOperator)

Convert an operator, presumably a unitary operator, to its representation as a

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notation nit, but... I guess it doesn't need to be a unitary, right? Any operator acting on the density matrix would be made into a PTM in the same way. There aren't any assumptions about unitarity. If you agree, I might suggest a variable name change, and removing the "presumably unitary" part, if only because I found the comment confusing and unhelpful. In the context of qutip I think this would be called something like prepost?

But you might just call it op.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i actually do need guidance on this - does it make any sense to perform this operation on non-unitary operators?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert on this, but it seems to me that the PTM representation can be used on any quantum map, i.e. the only condition the operator here has to fulfill is that, when applied to a density operator, we obtain another density operator. In that sense it doesn't have to be a unitary. Or am I mistaken here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you are right. the code will work certainly for any operator, but i will change the wording if you think that would be more clear.

src/pauli.jl Outdated Show resolved Hide resolved
src/pauli.jl Outdated Show resolved Hide resolved
src/pauli.jl Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jun 26, 2019

Coverage Status

Coverage decreased (-0.08%) to 96.444% when pulling 3398cb6 on atombear:feature/quantum_information_pauli into b46911d on qojulia:master.

src/pauli.jl Outdated Show resolved Hide resolved
@atombear atombear force-pushed the feature/quantum_information_pauli branch from 21c0c5e to f68f832 Compare June 30, 2019 01:05
@codecov
Copy link

codecov bot commented Jun 30, 2019

Codecov Report

Merging #251 into master will decrease coverage by 0.05%.
The diff coverage is 94.02%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #251      +/-   ##
==========================================
- Coverage   96.52%   96.47%   -0.06%     
==========================================
  Files          37       38       +1     
  Lines        2965     3032      +67     
==========================================
+ Hits         2862     2925      +63     
- Misses        103      107       +4
Impacted Files Coverage Δ
src/QuantumOptics.jl 100% <ø> (ø) ⬆️
src/pauli.jl 94.02% <94.02%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b46911d...6acd8b6. Read the comment docs.

@atombear
Copy link
Contributor Author

atombear commented Jul 6, 2019

@david-pl i think this is ready for review!

Copy link
Member

@david-pl david-pl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all this work. It seems to me that things are almost ready.

As I'm not so familiar with the theory I have one more question:
The way things are implemented now, there is no fast multiplication (gemm!) for the new PTM and chi-matrix types. Since we're not computing any time evolution, I take it that efficiency is not so relevant here, correct?

Also, we could think about adding some printing methods for the new types. As these include a lot of type parameters, the output right now is rather cluttered. We can also leave this as a later change, though, and I will merge this regardless. So it's up to you whether you want to do this right away.

src/QuantumOptics.jl Outdated Show resolved Hide resolved
src/pauli.jl Outdated Show resolved Hide resolved
"""
PauliTransferMatrix(unitary::DenseOperator)

Convert an operator, presumably a unitary operator, to its representation as a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert on this, but it seems to me that the PTM representation can be used on any quantum map, i.e. the only condition the operator here has to fulfill is that, when applied to a density operator, we obtain another density operator. In that sense it doesn't have to be a unitary. Or am I mistaken here?

src/spin.jl Outdated Show resolved Hide resolved
@atombear
Copy link
Contributor Author

atombear commented Jul 19, 2019

I had forgotten to add composition - for PTM it is just matrix multiplication. for chi, it is not... I have working functionality, though I assume it is far from optimal.

wrt pretty printing... i would rather do that in a separate pr. do you believe me if i say i promise i will?

@atombear
Copy link
Contributor Author

@david-pl i believe i have addressed all concerns.

@codecov
Copy link

codecov bot commented Jul 19, 2019

Codecov Report

Merging #251 into master will decrease coverage by 0.08%.
The diff coverage is 93.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #251      +/-   ##
==========================================
- Coverage   96.52%   96.44%   -0.09%     
==========================================
  Files          37       38       +1     
  Lines        2965     3037      +72     
==========================================
+ Hits         2862     2929      +67     
- Misses        103      108       +5
Impacted Files Coverage Δ
src/QuantumOptics.jl 100% <ø> (ø) ⬆️
src/pauli.jl 93.05% <93.05%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b46911d...3398cb6. Read the comment docs.

src/pauli.jl Show resolved Hide resolved
src/pauli.jl Outdated Show resolved Hide resolved
@atombear
Copy link
Contributor Author

@david-pl i think i have addressed all concerns.

@david-pl david-pl merged commit c7b1855 into qojulia:master Jul 27, 2019
@david-pl
Copy link
Member

@atombear Thanks for all the work on this!

karolpezet added a commit to karolpezet/QuantumOptics.jl that referenced this pull request Feb 12, 2020
* fix ishermitian for dense and sparse operator

* Fix manybody deprecated syntax

* Change steady state sorting (qojulia#231)

* Sort by absolute value of real part

* Move normalization and sort by absolute value

* Update checking and error message

* Fix steady eig docstring formatting

* Bump REQUIRE to v0.7-beta2 (qojulia#230)

* Bump REQUIRE to v0.7-beta2

* Fix deprecations

* Fix deprecations

* Remove Compat imports

* Change WignerSymbols version

* First successful build

* Fock tests pass

* Some more tests pass

* All tests except printing pass

* Replace Complex128 with ComplexF64 in tests

* Rename Complex128 to ComplexF64

* Add FFTW requirement

* Update printing

* Add Arpack requirement

* Add rounding to printing

* Update tests to use 0.7

* Fix compilation deprecation warnings

* Fix printing

* Fix deprecations

* Rename full to dense

* Fix some more deprecations

* More deprecations

* Fix operator deprecations

* Fix particle deprecations

* Fix all deprecations occurring in tests

* Update REQUIRE

* Update appveyor

* Fix a bug in subspace; export norm

* Fix silly bug in subspace

* v0.7 compatibility

* Implement macros to skip checks

commit f221430
Author: david-pl <david.plankensteiner@gmx.at>
Date:   Fri Aug 17 11:16:22 2018 +0200

    Update macro docstrings

commit 62f10e8
Author: David Plankensteiner <david.plankensteiner@uibk.ac.at>
Date:   Tue Aug 14 21:17:58 2018 +0200

    Fix stochastic checks

commit 5c9eff5
Author: David Plankensteiner <david.plankensteiner@uibk.ac.at>
Date:   Tue Aug 14 20:45:51 2018 +0200

    Rename macros

commit f78cf33
Author: david-pl <david.plankensteiner@gmx.at>
Date:   Tue Aug 14 16:01:36 2018 +0200

    Start renaming stuff

commit c5f8bd6
Author: David Plankensteiner <david.plankensteiner@uibk.ac.at>
Date:   Mon Aug 13 20:25:58 2018 +0200

    Implement macros to skip checks

* Define ' on Operator as dagger (qojulia#235)

* fix typo

* Enable v1.0 testing

* Implement parametric types (qojulia#238)

* Start parametric typing for Ket/Bra

* Fix tensor vararg for StateVector

* Fix subspacebasis field parameters

* Fix semiclassical state for kets

* Update testing scripts

* Fix typo in appveyor

* Fix semiclassical_stochastic ket typing

* Fix travis 1.0 testing

* Parametric typing for CompositeBasis

* Rename Operator to AbstractOperator

* Proper parametric type for CompositeBasis

* Parametric typing for operators

* Parametrize basis dimensions

* Revert "Parametrize basis dimensions"

This reverts commit b451987.

* Update basis checks for states

* Update basis checks for dense operators

* Update basis checks for sparse operators

* Update LazyProduct implementation

* Update LazySum implementation

* Update LazyTensor implementation

* Add non-type parameters where needed to ensure correct basis dispatch

* Update basis checks for schroedinger

* Update basis checks for metrics

* Update basis checks for phasespace

* Update basis checks for master

* Update basis checks for mcwf

* Update basis checks for semiclassical

* Update superoperators and steadystate

* Update basis checks for stochastic solvers

* Update timecorrelations basis checks

* Added parameter to FFToperators so the gemv! is type stable

* Add basis checks to FFT in-place multiplication

* Implement transpose forsparse/dense operators

* Proper recasting in mcwf

* Add some missing basis checks

* Fix silly copy-paste error

* Less strict typing for liouvillian

* Mention gitter in readme text

* Some dots for states and operators
Squashed commit of the following:

commit abc523b
Author: david-pl <david.plankensteiner@gmx.at>
Date:   Fri Jan 11 10:28:33 2019 +0100

    Broadcasting for states, operators and superoperators

commit 838f717
Author: David Plankensteiner <david.plankensteiner@uibk.ac.at>
Date:   Sat Dec 8 12:59:47 2018 +0100

    Use custom broadcasting styles

commit bedef6e
Author: David Plankensteiner <david.plankensteiner@uibk.ac.at>
Date:   Fri Dec 7 11:49:40 2018 +0100

    Broadcasting for sparse and dense operators

* Fix typo in macro export

* Fix @warn and implement adjoint(StateVector)

* Update tests to newer Julia versions

* Fix documentation of gaussianstate

* Patch failing tests

* created coherentstate! for inplace operations

* Fix bug in MCWF display_afterevent

* before embedding check that the destination basis matches the operator basis (qojulia#246)

* before embedding check that the destination basis matches the operator basis

* Change embed to handle composite operators

* perform embedding of an operator in a joint hilbert space

* functional embedding with new syntax

* more tests for composite bases

* code review and a few more tests

* Change Int64 to Int in type checks for x86

* remove intersect and union from sortedindices, as there are appropriate methods in Base

* Fix default choice of noise for stochastics

* Add Bloch-Redfield master equation (qojulia#250)

* Added bloch_redfield_master submodule

Added the option for a Bloch-Redfield master equation in the timeevolution module

* Add files via upload

* Delete bloch_redfield_master.jl

* Delete QuantumOptics.jl

* Update bloch_redfield_master.jl

* Cleaned up and commented new bloch_redfield_master submodule

* Delete bloch_redfield_master.jl

* Moved bloch_redfield_master to correct location...

* Re-added coherentstate! (inplace)

* Add simple test

* Include new test file

* Replace vec2mat_index by CartesianIndices

* Use timeevolution_base for BR master

* Added docstrings and renamed c_ops kwarg to J

Changed c_ops kwarg in bloch_redfield_tensor to J to be consistent with Linblad ME implementation

* Fix a bug and better saving

* Type-stable fout

* Fixed docstring typos in bloch_redfield_master

* Update README.md

* Switch to Project.toml

* Update Project.toml

* Abstractions for quantum information on qubits (qojulia#251)

* created abstractions for quantum information on qubits

* changed how equality is handled and added tests

* code review

* cleanup on types and added tests

* code review and composition for chi and ptm

* better caching

* code review for isapprox vs ==

* Move windows tests to travis

* Improve in-place multiplication for lazy types

* Patch bug in mcwf_dynamic

* Make entropy_vn type-stable

* Update Project.toml

* Restrict broadcasting of functions on states and operators

* Make bases immutable

* use ARPACKException from Arpack.jl

* Semiclassical MCWF (qojulia#255)

* MCWF jump times and indices (qojulia#257)

* semicl mcwf

* semicl mcwf läuft

* semiclassical mcfw

* Change MCWF interface to display jumps

* Semiclassical mcwf with display event

* Add display_which and display_t to semiclassical mcwf

* Clean up integrate_mcwf

* Clean up semiclassical mcwf

* Add docstrings

* Add docstrings in semiclassical.mcwf

* Fix tests

* Update Project.toml

* Remove QuantumOpticsBase functionality (qojulia#259)

* Remove QuantumOpticsBase functionality

* Re-add changes to mcwf interface lost during deletion

* Update semiclassical mcwf docstrings

* Fix precompilation

* Add superoperator tests that cannot run in Base

* Re-add spectralanalysis

* Separate stochastic base functionality from timeevolution

* Update Project.toml

* Type-stable bloch_redfield_tensor (qojulia#262)

* Made bloch_redfield_tensor function type-stable

* Quick patch failing tests

* Install TagBot as a GitHub Action

* Update Project.toml

Co-authored-by: goropikari <goropikari56@gmail.com>
Co-authored-by: David Plankensteiner <david-pl@users.noreply.github.com>
Co-authored-by: David Nadlinger <code@klickverbot.at>
Co-authored-by: Louis Ponet <louisponet@gmail.com>
Co-authored-by: wolfgang-n <33723682+wolfgang-n@users.noreply.github.com>
Co-authored-by: alexander papageorge <atpapag@gmail.com>
Co-authored-by: sd109 <49713135+sd109@users.noreply.github.com>
Co-authored-by: Kristoffer Carlsson <kristoffer.carlsson@chalmers.se>
Co-authored-by: Julia TagBot <50554310+JuliaTagBot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants