Opened 14 months ago
Last modified 9 months ago
#26589 needs_work enhancement
allow custom multiplication function in power
Reported by:  vdelecroix  Owned by:  

Priority:  major  Milestone:  sage8.5 
Component:  basic arithmetic  Keywords:  
Cc:  cpernet, jdemeyer  Merged in:  
Authors:  Vincent Delecroix  Reviewers:  Daniel Krenn 
Report Upstream:  N/A  Work issues:  
Branch:  u/vdelecroix/26589 (Commits)  Commit:  6a86800c69eaa378bdabdff46f116f8b4d74d8f0 
Dependencies:  Stopgaps: 
Description
Add an option in sage.arith.power.generic_power
for custom multiplication function.
Change History (6)
comment:1 Changed 14 months ago by
 Branch set to u/vdelecroix/26589
 Commit set to b026a18b8f52ac559b0b22409397c68628c45c3f
 Status changed from new to needs_review
comment:2 Changed 14 months ago by
 Commit changed from b026a18b8f52ac559b0b22409397c68628c45c3f to 6a86800c69eaa378bdabdff46f116f8b4d74d8f0
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
6a86800  26589: custom mul/inv functions in generic power

comment:3 Changed 14 months ago by
It would be cool if you could pass a C function pointer. That way, you would strictly generalize the existing code (using PyNumber_Multiply
in place of *
).
comment:4 Changed 14 months ago by
PyNumber_InPlaceMultiply
?
comment:5 Changed 9 months ago by
 Reviewers set to Daniel Krenn
 Status changed from needs_review to needs_work
Looks almost good to me, three very minor comments:
 Is this kind of a convention to name function with postfix
2
?Could something more descriptive be found easily?cdef generic_power_pos(a, ulong_or_object n) # n > 0 +cdef generic_power_pos2(a, ulong_or_object n, mul)
 parameter is called
inv
, isn't it?
+  ``invert``  an optional function for inversion (only used
 This is more like a question:
Are there no doctests required here? What is the rule? (Coverage is happy)
+cdef generic_power_pos2(a, ulong_or_object n, mul): + """ + Return `a^n` where `n > 0`. + """
comment:6 Changed 9 months ago by
I think that comment:3 should also be considered. But we thought about it and did not arrive to any reasonable conclusion.
Note: See
TracTickets for help on using
tickets.
New commits:
patch for openblas
26589: custom mul/inv functions in generic power