Skip to content

Commit f91978b

Browse files
committed
Add bases for superoperators and move AbstractSuperOperatorType to deprecated.jl
1 parent 1514e31 commit f91978b

File tree

3 files changed

+50
-16
lines changed

3 files changed

+50
-16
lines changed

src/abstract_types.jl

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,4 @@ terms of this function and are provided automatically.
4343
"""
4444
abstract type AbstractOperator end
4545

46-
"""
47-
Base class for all super operator classes.
48-
49-
Super operators are bijective mappings from operators given in one specific
50-
basis to operators, possibly given in respect to another, different basis.
51-
To embed super operators in an algebraic framework they are defined with a
52-
left hand basis `basis_l` and a right hand basis `basis_r` where each of
53-
them again consists of a left and right hand basis.
54-
```math
55-
A_{bl_1,bl_2} = S_{(bl_1,bl_2) ↔ (br_1,br_2)} B_{br_1,br_2}
56-
\\\\
57-
A_{br_1,br_2} = B_{bl_1,bl_2} S_{(bl_1,bl_2) ↔ (br_1,br_2)}
58-
```
59-
"""
60-
abstract type AbstractSuperOperator end
61-
6246
const AbstractQObjType = Union{<:StateVector,<:AbstractOperator}

src/bases.jl

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,51 @@ Base.:(==)(b1::T, b2::T) where T<:SumBasis = equal_shape(b1.shape, b2.shape)
161161
Base.:(==)(b1::SumBasis, b2::SumBasis) = false
162162
Base.length(b::SumBasis) = sum(b.shape)
163163
# TODO how should `.bases` be accessed? `getindex` or a `sumbases` method?
164+
165+
##
166+
# Operator Bases
167+
##
168+
169+
"""
170+
KetBraBasis(BL,BR)
171+
172+
Typical "Ket-Bra" outter-product Basis.
173+
TODO: write more...
174+
"""
175+
struct KetBraBasis <: Basis
176+
left::Basis
177+
right::Basis
178+
end
179+
KetBraBasis(b::Basis) = KetBraBasis(b,b)
180+
basis_l(b::KetBraBasis) = b.left
181+
basis_r(b::KetBraBasis) = b.right
182+
Base.:(==)(b1::KetBraBasis, b2::KetBraBasis) = (b1.left == b2.left && b1.right == b2.right)
183+
Base.length(b::KetBraBasis) = length(b.left)*length(b.right)
184+
Base.size(b::KetBraBasis) = (length(b.left), length(b.right))
185+
186+
struct ChoiRefSysBasis <: Basis
187+
basis::Basis
188+
end
189+
Base.:(==)(b1::ChoiRefSysBasis, b2::ChoiRefSysBasis) = (b1.basis == b2.basis)
190+
Base.length(b::ChoiRefSysBasis) = length(b.basis)
191+
Base.size(b::ChoiRefSysBasis) = (length(b.basis),)
192+
193+
struct ChoiOutSysBasis <: Basis
194+
basis::Basis
195+
end
196+
Base.:(==)(b1::ChoiOutSysBasis, b2::ChoiOutSysBasis) = (b1.basis == b2.basis)
197+
Base.length(b::ChoiOutSysBasis) = length(b.basis)
198+
Base.size(b::ChoiOutSysBasis) = (length(b.basis),)
199+
200+
201+
"""
202+
_PauliBasis()
203+
204+
Pauli operator basis consisting of I, Z, X, Y, in that order.
205+
"""
206+
struct _PauliBasis <: Basis
207+
end
208+
209+
Base.:(==)(pb1::_PauliBasis, pb2::_PauliBasis) = true
210+
Base.length(b::_PauliBasis) = 4
211+
Base.size(b::_PauliBasis) = (4,)

src/deprecated.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# TODO: figure out how to deprecate abstract type
2+
abstract type AbstractSuperOperator end
13

24
basis(a::AbstractSuperOperator) = (check_samebases(a); a.basis_l[1]) # FIXME issue #12
35

0 commit comments

Comments
 (0)