On 29 Mai, 21:49, Mateusz Paprocki <[email protected]> wrote:
> If you want to write generic algorithms, you can't assume that you work with
> any particular ground type. The same as you can't assume that integer
> multiplication is implemented efficiently (mpz vs. int), the same you can't
> assume that Add() exists. What exists is + operator. It's SymPy's problem
> that sum(X) is O(len(X)**2) algorithm, but this is just because we use lists
> instead of dicts for the internal implementation of Add. This will change in
> future.

It might make sense to define a generic 'sum' which depends on the
context (the ground type). For Expr instances it should be Add(*...),
for python integer sum(...), for mpmath numbers it would be fsum(...)
etc.

Vinzent

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" 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/sympy?hl=en.

Reply via email to