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

Export and document static_operator #169

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ sparse(::AbstractOperator)
current_time
```

```@docs
static_operator
```

```@docs
set_time!
```
Expand Down
2 changes: 1 addition & 1 deletion src/QuantumOpticsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export Basis, GenericBasis, CompositeBasis, basis,
LazyKet,
#time_dependent_operators
AbstractTimeDependentOperator, TimeDependentSum, set_time!,
current_time, time_shift, time_stretch, time_restrict,
current_time, time_shift, time_stretch, time_restrict, static_operator,
#superoperators
SuperOperator, DenseSuperOperator, DenseSuperOpType,
SparseSuperOperator, SparseSuperOpType, spre, spost, sprepost, liouvillian,
Expand Down
11 changes: 11 additions & 0 deletions src/time_dependent_operator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ this throws an `ArgumentError`.
"""
current_time(::T) where {T<:AbstractOperator} =
throw(ArgumentError("Time not defined for operators of type $T. Consider using a TimeDependentSum or another time-dependence wrapper."))

"""
static_operator(op::AbstractOperator)

Returns a static (not time dependent) representation of `op` the current time.
This strips the time-dependence and can be used to obtain a non-lazy matrix
representation of the operator.

For example: `sparse(static_operator(op(t))` return a sparse-matrix representation
of `op` at time `t`.
"""
static_operator(o::AbstractOperator) = o

"""
Expand Down
Loading