> However, due to the representation as streams, even if I only want to
> compute \sum_{d | n} f(d) for a specific n, say n=70, the package
> computes f(k) for all k in {1,2,...,70}, instead of just
> {1,2,5,7,10,14,35,70}. What a waste!
> So I was thinking of a representation like
>
> Rep := Stream Union(Coef, "not yet computed")
>
> and adapt elt and coerce accordingly. Actually, I'd really like
> something like
>
> Rep := PositiveInteger -> Coef
>
> which is however caching values. Or maybe I should just forget about
> the caching?
Ever thought about Table(PositiveInteger, Coef)?
But that probably doesn't work. Maybe you can think of
Rep == Record(f: PI -> Coef, cache: Table(PI, Coef))
Then you might need to decide what to do in case of a replacement for
- (f: %) == map(- #1, f::Stream(Coef))$Stream(Coef)
Mapping - to all cached values immediately, is probably not a good idea
if you have a lot of members in the cache. I don't yet have a good idea
of delaying such an operation. The other option you have is, to remove
all cached values. Also bad.
Ralf
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.