|
| 1 | +""" |
| 2 | + struct FixedBasis{B,M,T,V} <: |
| 3 | + SA.ExplicitBasis{SA.AlgebraElement{Algebra{FullBasis{B,M},B,M},T,V},Int} |
| 4 | + elements::Vector{SA.AlgebraElement{Algebra{FullBasis{B,M},B,M},T,V}} |
| 5 | + end |
| 6 | +
|
| 7 | +Fixed basis with polynomials `elements`. |
| 8 | +""" |
| 9 | +struct FixedBasis{B,M,T,V} <: |
| 10 | + SA.ExplicitBasis{SA.AlgebraElement{Algebra{FullBasis{B,M},B,M},T,V},Int} |
| 11 | + elements::Vector{SA.AlgebraElement{Algebra{FullBasis{B,M},B,M},T,V}} |
| 12 | +end |
| 13 | + |
| 14 | +Base.length(b::FixedBasis) = length(b.elements) |
| 15 | +Base.getindex(b::FixedBasis, i::Integer) = b.elements[i] |
| 16 | + |
| 17 | +function Base.show(io::IO, b::FixedBasis) |
| 18 | + print(io, "FixedBasis(") |
| 19 | + _show_vector(io, MIME"text/plain"(), b.elements) |
| 20 | + print(io, ")") |
| 21 | + return |
| 22 | +end |
| 23 | + |
| 24 | +""" |
| 25 | + struct SemisimpleBasis{T,I,B<:SA.ExplicitBasis{T,I}} <: SA.ExplicitBasis{T,I} |
| 26 | + bases::Vector{B} |
| 27 | + end |
| 28 | +
|
| 29 | +Semisimple basis for use with [SymbolicWedderburn](https://github.com/kalmarek/SymbolicWedderburn.jl/). |
| 30 | +Its elements are of [`SemisimpleElement`](@ref)s. |
| 31 | +""" |
| 32 | +struct SemisimpleBasis{T,I,B<:SA.ExplicitBasis{T,I}} <: SA.ExplicitBasis{T,I} |
| 33 | + bases::Vector{B} |
| 34 | +end |
| 35 | + |
| 36 | +Base.length(b::SemisimpleBasis) = length(first(b.bases)) |
| 37 | + |
| 38 | +""" |
| 39 | + struct SemisimpleElement{P} |
| 40 | + polynomials::Vector{P} |
| 41 | + end |
| 42 | +
|
| 43 | +Elements of [`SemisimpleBasis`](@ref). |
| 44 | +""" |
| 45 | +struct SemisimpleElement{P} |
| 46 | + elements::Vector{P} |
| 47 | +end |
| 48 | +SA.star(p::SemisimpleElement) = SemisimpleElement(SA.star.(p.elements)) |
| 49 | + |
| 50 | +function Base.getindex(b::SemisimpleBasis, i::Integer) |
| 51 | + return SemisimpleElement(getindex.(b.bases, i)) |
| 52 | +end |
| 53 | + |
| 54 | +function Base.show(io::IO, b::SemisimpleBasis) |
| 55 | + if length(b.bases) == 1 |
| 56 | + print(io, "Simple basis:") |
| 57 | + else |
| 58 | + print(io, "Semisimple basis with $(length(b.bases)) simple sub-bases:") |
| 59 | + end |
| 60 | + for basis in b.bases |
| 61 | + println(io) |
| 62 | + print(io, " ") |
| 63 | + print(io, basis) |
| 64 | + end |
| 65 | +end |
0 commit comments