Skip to content

Commit 3f73a57

Browse files
authored
Export and document static_operator. (#169)
1 parent 5c31a46 commit 3f73a57

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

docs/src/api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ sparse(::AbstractOperator)
236236
current_time
237237
```
238238

239+
```@docs
240+
static_operator
241+
```
242+
239243
```@docs
240244
set_time!
241245
```

src/QuantumOpticsBase.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export Basis, GenericBasis, CompositeBasis, basis,
3232
LazyKet,
3333
#time_dependent_operators
3434
AbstractTimeDependentOperator, TimeDependentSum, set_time!,
35-
current_time, time_shift, time_stretch, time_restrict,
35+
current_time, time_shift, time_stretch, time_restrict, static_operator,
3636
#superoperators
3737
SuperOperator, DenseSuperOperator, DenseSuperOpType,
3838
SparseSuperOperator, SparseSuperOpType, spre, spost, sprepost, liouvillian,

src/time_dependent_operator.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ this throws an `ArgumentError`.
2222
"""
2323
current_time(::T) where {T<:AbstractOperator} =
2424
throw(ArgumentError("Time not defined for operators of type $T. Consider using a TimeDependentSum or another time-dependence wrapper."))
25+
26+
"""
27+
static_operator(op::AbstractOperator)
28+
29+
Returns a static (not time dependent) representation of `op` the current time.
30+
This strips the time-dependence and can be used to obtain a non-lazy matrix
31+
representation of the operator.
32+
33+
For example: `sparse(static_operator(op(t))` return a sparse-matrix representation
34+
of `op` at time `t`.
35+
"""
2536
static_operator(o::AbstractOperator) = o
2637

2738
"""

0 commit comments

Comments
 (0)