Skip to content
Closed
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
14 changes: 14 additions & 0 deletions src/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,20 @@ function embed(basis_l::CompositeBasis, basis_r::CompositeBasis,
return Operator(basis_l, basis_r, data)
end

"""
embed(basis::Basis, indices, ops::AbstractOperator)

Special case of the `embed` to handle embedding an operator `ops` into a single
basis.
"""
function embed(basis::Basis, indices, ops::AbstractOperator)
if indices == 1 || indices == (1,) || indices == [1]
return ops
else
throw(ArgumentError("Invalid indices for single basis."))
end
end

"""
expect(op, state)

Expand Down