Skip to content

Commit bf5f454

Browse files
committed
Elimite type parameters from abstract types and add fullbasis function
1 parent f17ee1e commit bf5f454

File tree

5 files changed

+27
-10
lines changed

5 files changed

+27
-10
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# News
22

3+
## v0.4.0 - 2024-11-26
4+
5+
- Add `OperatorBasis` and `SuperOperatorBasis` abstract types along with corresponding `fullbasis` function to obtain these from instances of subtypes of `AbstractOperator` and `AbstractSuperOperator`.
6+
- Change type parameters for `StateVector`, `AbstractKet` `AbstractBra` `AbstractOperator` `AbstractSuperOperator` to elimitate all type parameters.
7+
8+
39
## v0.3.6 - 2024-09-08
410

511
- Add `coherentstate`, `thermalstate`, `displace`, `squeeze`, `wigner`, previously from QuantumOptics.

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "QuantumInterface"
22
uuid = "5717a53b-5d69-4fa3-b976-0bf2f97ca1e5"
33
authors = ["QuantumInterface.jl contributors"]
4-
version = "0.3.6"
4+
version = "0.4.0"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/QuantumInterface.jl

+13-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,22 @@ module QuantumInterface
99
1010
Return the basis of an object.
1111
12-
If it's ambiguous, e.g. if an operator has a different left and right basis,
13-
an [`IncompatibleBases`](@ref) error is thrown.
12+
If it's ambiguous, e.g. if an operator or superoperator has a different
13+
left and right basis, an [`IncompatibleBases`](@ref) error is thrown.
1414
"""
1515
function basis end
1616

17+
"""
18+
fullbasis(a)
19+
20+
Return the full basis of an object.
21+
22+
Returns subtype of `Basis` when a is a subtype of `StateVector`.
23+
Returns a subtype of `OperatorBasis` a is a subtype of `AbstractOperator`.
24+
Returns a subtype of `SuperOperatorBasis` when a is a subtype of `AbstractSuperOperator`.
25+
"""
26+
function fullbasis end
27+
1728
##
1829
# Standard methods
1930
##

src/abstract_types.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ in respect to a certain basis. These coefficients are stored in the
2121
`data` field and the basis is defined in the `basis`
2222
field.
2323
"""
24-
abstract type StateVector{B,T} end
25-
abstract type AbstractKet{B,T} <: StateVector{B,T} end
26-
abstract type AbstractBra{B,T} <: StateVector{B,T} end
24+
abstract type StateVector end
25+
abstract type AbstractKet <: StateVector end
26+
abstract type AbstractBra <: StateVector end
2727

2828
"""
2929
Abstract base class for all operators.
@@ -36,7 +36,7 @@ For fast time evolution also at least the function
3636
implemented. Many other generic multiplication functions can be defined in
3737
terms of this function and are provided automatically.
3838
"""
39-
abstract type AbstractOperator{BL,BR} end
39+
abstract type AbstractOperator end
4040

4141
"""
4242
Base class for all super operator classes.
@@ -52,4 +52,4 @@ A_{bl_1,bl_2} = S_{(bl_1,bl_2) ↔ (br_1,br_2)} B_{br_1,br_2}
5252
A_{br_1,br_2} = B_{bl_1,bl_2} S_{(bl_1,bl_2) ↔ (br_1,br_2)}
5353
```
5454
"""
55-
abstract type AbstractSuperOperator{B1,B2} end
55+
abstract type AbstractSuperOperator end

src/julia_linalg.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tr(x::AbstractOperator) = arithmetic_unary_error("Trace", x)
1919
2020
Norm of the given bra or ket state.
2121
"""
22-
norm(x::StateVector) = norm(x.data)
22+
norm(x::StateVector) = norm(x.data) # FIXME issue #12
2323

2424
"""
2525
normalize(x::StateVector)
@@ -33,7 +33,7 @@ normalize(x::StateVector) = x/norm(x)
3333
3434
In-place normalization of the given bra or ket so that `norm(x)` is one.
3535
"""
36-
normalize!(x::StateVector) = (normalize!(x.data); x)
36+
normalize!(x::StateVector) = (normalize!(x.data); x) # FIXME issue #12
3737

3838
"""
3939
normalize(op)

0 commit comments

Comments
 (0)