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

Handle single basis in embed #24

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
13 changes: 13 additions & 0 deletions src/embed_permute.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ embed(basis_l::CompositeBasis, basis_r::CompositeBasis, index::Integer, op::Abst
embed(basis::CompositeBasis, indices, operators::Vector{T}) where {T<:AbstractOperator} = embed(basis, basis, indices, operators)
embed(basis::CompositeBasis, indices, op::AbstractOperator) = embed(basis, basis, indices, op)

"""
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

"""
embed(basis1[, basis2], indices::Vector, operators::Vector)
Expand Down
Loading