Open fieker opened 4 days ago
I think @ThomasBreuer last worked on this function, maybe you could have a look?
Yes, we should proceed as sketched at the end of discussion in #3796. I will provide a pull request.
@fieker Currently map_word
does not work at all for evaluating a word in a vector of FinGenAbGroupElem
s. We need a separate method for them that translates multiplication and powering into addition and scalar multiplication. (In this sense, this particular problem is not one of a missing init
handling.)
Other generic algorithms (which ones?) will fail for FinGenAbGroupElem
s for the same reason.
I think we encountered this before. Two options that I remember:
MultGrp
/MultGrpElem
). For example
function map_word(g, v::Vector{FinGenAbGroupElem})
unwrap(g, wrap.(v))
_op
, _inv
shenanigans where we rewrite the relevant methods and replace x * y
with _op(x, y)
etc. and define
_op(x::GAPGroupElem, y::GAPGroupElem) = x * y
_op(x::FinGenAbGroupElem, y::FinGenAbGroupElem) = x + y
etc.
Edit: There is of course the obvious solution. Just define another map_word(g, v::Vector{FinGenAbGroupElem})
method and use +
instead of *
etc.
On Mon, Jun 24, 2024 at 09:04:05AM -0700, Thomas Breuer wrote:
@fieker Currently
map_word
does not work at all for evaluating a word in a vector ofFinGenAbGroupElem
s. We need a separate method for them that translates multiplication and powering into addition and scalar multiplication. (In this sense, this particular problem is not one of a missinginit
handling.) Other generic algorithms (which ones?) will fail forFinGenAbGroupElem
s for the same reason.I agree - but I'd still like to not ignore init... - or be honest and not provide the option at all -- Reply to this email directly or view it on GitHub: https://github.com/oscar-system/Oscar.jl/issues/3885#issuecomment-2186916549 You are receiving this because you were mentioned.
Message ID: @.***>
On Mon, Jun 24, 2024 at 09:16:43AM -0700, Tommy Hofmann wrote:
I think we encountered this before. Two options that I remember:
- We wrap/unwrap the abelian group (doing the opposite of
MultGrp
/MultGrpElem
). For examplefunction map_word(g, v::Vector{FinGenAbGroupElem}) unwrap(g, wrap.(v))
- We do some
_op
,_inv
shenanigans where we rewrite the relevant methods and replacex * y
with_op(x, y)
etc. and define_op(x::GAPGroupElem, y::GAPGroupElem) = x * y _op(x::FinGenAbGroupElem, y::FinGenAbGroupElem) = x + y
etc.
The abelian group stuff is irrelevant for this, was a bad example by me. My complaint really is about ignoring the init argument and instead of blindly relying that one(s.th.) does the correct thing. The other question that was asked is if init needs to be used if present as this might also change type and results, or if init may be ignored if not needed.
My original problem was map_word(GrpElem, Vector{Map}) where, in general, we do not have one(Map). In GModule(s) I've added this for abelian groups and AA.Generic.Modules, but e.g. ERROR: MethodError: no method matching one(::NumFieldHom{…}) Hence this discussion...
The "reverse" to MultGroup is a different thing and might be useful.
-- Reply to this email directly or view it on GitHub: https://github.com/oscar-system/Oscar.jl/issues/3885#issuecomment-2186941891 You are receiving this because you were mentioned.
Message ID: @.***>
Julia always honors init
if given:
julia> sum(1:10; init=5)
60
julia> prod(1:10; init=0)
0
so I think we should mimic that.
@fingolfin The documentation of prod
emphasizes that
it is unspecified whether `init` is used for non-empty collections.
I think it is a good idea to initialize the product in map_word
with a given init
value.
Then we document this for map_word
.
(We cannot implement this behaviour by just calling prod
on the image syllables and with the given init
value.)
@thofma Yes, I am going to provide map_word(g, v::Vector{FinGenAbGroupElem})
with "additive meaning".
then
will fail as it calls for one(A[1]) which does not exist. It ignores the init....