Skip to content

Polynomial.py Optimization #4610

Closed
@odysseus9672

Description

@odysseus9672

polyval in Polynomial.py is about 5 times slower than an implementation based on reduce. I would suggest replacing the following lines (672 and 673):
for i in range(len(p)):
y = x * y + p[i]
return y
with:
return reduce( lambda y, c: y * x + c, p )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions