On 09/18/2017 12:05 PM, oldk1331 wrote:
> Another place to speed up:
>
> About 10% time is spent on 'totalDegree' of GDMP,
>
> totalDegree p ==
> zero? p => 0
> "max"/[reduce("+",(t.k)::(Vector NNI), 0) for t in p]
>
> t.k is of type E which has category DirectProductCategory(#vl,
> NonNegativeInteger).
Huh? Can you give a URL (github) to point me to this specific definition
of totalDegree in FriCAS. I only see something similar to your code in
jet.spad. But that is irrelevant here.
> The problem is in the coercion to Vector, it causes a copy.
> Of cource it doesn't need a copy to count the degree, but
> there's no 'reduce' function exported for DirectProductCategory.
>
> I wonder how to add 'reduce' to DirectProductCategory.
> 'reduce' comes from Collection, but DirectProductCategory
> is unfit to be a collection because it has fixed number of elements.
Before I answer, I need a true code link.
Anyway, in general, you are right. For the computation of totalDegree,
there is only need for a single variable of type NNI to hold the final
total degree. No need to allocate vectors or lists.
I'd be happy if we can optimize needless memory allocation.
Ralf
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.