On 2/26/23 04:18, Waldek Hebisch wrote:
On Thu, Oct 06, 2022 at 08:24:09AM +0800, Qian Yun wrote:
By using macros, this avoids code duplication.
One minor question: the exported signature should belong to
IndexedDirectProductCategory or IndexedProductCategory?
They look similar to me...
- Qian
First, let me note that this is "dangerous" patch. Namely
mathematical objects should be unmutable. We allow mutation
to get better performance, but mutation is used in specific
patterns that are safe. So, basic question is what is
intended pattern of use of 'add!'. Related question is
what we gain. We already have 'pomopo!' which covers
typical case where mutation gives gain.
The purpose of "add!" is to optimize sparse polynomial multiplication,
(as I said in other threads), which 'pomopo!' can't do.
As extra remark, let me mention that result of 'add' can
share nodes with any of its arguments. If the same holds
for 'add!', then using 'add!' again on the result may modify
both arguments of first 'add!'. Anyway, we need first to
formulate restrictions on use of 'add!' and only then we
can decide if it is correct.
Yes, the usage of 'add!' should be very careful, normally it
would be used for freshly allocated temporary objects, which
there is no data sharing with outside.
- Qian
Concering IndexedDirectProductCategory and IndexedProductCategory,
IndexedProductCategory allows things with infinite support,
like lazy power series. IndexedDirectProductCategory requires
that each element has finite support. Function that work
in general are exported from IndexedProductCategory, functions
that require finite support (directly or indirectly) should
go to IndexedDirectProductCategory. This is general guideline,
sometimes we have partial functions, that need finite support
but we want them in IndexedProductCategory, with understanding
that bad things (like infinite loop) will happen if somebody
applies them of object having really infinite support.
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/b8926f01-026f-2ec2-3b38-226dfaf67b8e%40gmail.com.