|
191 | 191 | # convert from counting type to bitstring type |
192 | 192 | for (F,TP) in [(:set_type, :ConfigEnumerator), (:sampler_type, :ConfigSampler)] |
193 | 193 | @eval begin |
194 | | - function $F(::Type{T}, n::Int, nflavor::Int) where {OT, T<:Max2Poly{C,OT} where C} |
195 | | - Max2Poly{$F(n,nflavor),OT} |
| 194 | + function $F(::Type{T}, n::Int, nflavor::Int) where {OT, K, T<:TruncatedPoly{K,C,OT} where C} |
| 195 | + TruncatedPoly{K, $F(n,nflavor),OT} |
196 | 196 | end |
197 | 197 | function $F(::Type{T}, n::Int, nflavor::Int) where {TX, T<:Polynomial{C,TX} where C} |
198 | 198 | Polynomial{$F(n,nflavor),:x} |
|
212 | 212 | function onehotv(::Type{Polynomial{BS,X}}, x, v) where {BS,X} |
213 | 213 | Polynomial{BS,X}([zero(BS), onehotv(BS, x, v)]) |
214 | 214 | end |
215 | | -function onehotv(::Type{Max2Poly{BS,OS}}, x, v) where {BS,OS} |
216 | | - Max2Poly{BS,OS}(zero(BS), onehotv(BS, x, v),one(OS)) |
| 215 | +function onehotv(::Type{TruncatedPoly{K,BS,OS}}, x, v) where {K,BS,OS} |
| 216 | + TruncatedPoly{K,BS,OS}(ntuple(i->i<K ? zero(BS) : onehotv(BS, x, v), K),one(OS)) |
217 | 217 | end |
218 | 218 | function onehotv(::Type{CountingTropical{TV,BS}}, x, v) where {TV,BS} |
219 | 219 | CountingTropical{TV,BS}(one(TV), onehotv(BS, x, v)) |
|
0 commit comments