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

Allow multiplication with different algebras #55

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
17 changes: 9 additions & 8 deletions src/arithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,24 @@ function MA.operate_to!(
::typeof(*),
args::Vararg{AlgebraElement,N},
) where {N}
for arg in args
@assert parent(res) == parent(arg)
end
mstr = mstructure(basis(res))
mstr = mstructure(parent(res), parent.(args)...)
MA.operate_to!(coeffs(res), mstr, coeffs.(args)...)
return res
end

function mstructure(args::AbstractStarAlgebra...)
for arg in args
@assert arg == first(args)
end
return mstructure(basis(args[1]))
end

function MA.operate!(
::UnsafeAddMul{typeof(*)},
res::AlgebraElement,
args::Vararg{AlgebraElement,N},
) where {N}
for arg in args
@assert parent(res) == parent(arg)
end
mstr = mstructure(basis(res))
mstr = mstructure(parent(res), parent.(args)...)
MA.operate!(UnsafeAddMul(mstr), coeffs(res), coeffs.(args)...)
return res
end
Expand Down
Loading