Comments (3)
the standard __getitem__
are design for list
, so it need all 0 <= i < n
exists in order to compute fibonacci at position n
.
since position
's algorithm see it as dictionary. i've try re-implement the InfiniteList
as InfiniteDict
to allowed the fibonacci use __getitem__
as native. this work flawlessly! but computation for many consecutive terms show significant time difference (sum up ~50k consecutive terms takes under 1 sec for old method, ~8 sec for the new one). so other approach shall be preferred.
from extmath.
testing n - len(fibonacci) >= large
then choose subroutine should be avoid. since there might be the situation that ask for sum(fibonacci[i] for i in range(larger, largest))
, its easily to see that if larger > large
then every consecutive fibonacci[i]
will be compute with the dictionary-way.
statistic analyse might be preferred to tell how much fibonacci[i]
should be kept, and use dictionary-way after this no meter input n
is.
from extmath.
just can't figure out how to achieve this, so done the __call__
way.
from extmath.
Related Issues (12)
- Instance of InfinityList (prime, fibonacci) doesn't handle properly with `print` in PyPy.
- Enchant `InfinityList` with `.test()` and `.position()`. HOT 1
- Change return type from list to generator for `factorized` and `divisors`. HOT 1
- Implement `sieve` for `prime`. HOT 1
- Rewrite factorized
- New class: NumericBase HOT 1
- Enchant `NumeralSystem` to accept complex system such as Roman numeral system.
- Clean up `indexargument`
- Enhance factorized with Quadratic Sieve.
- Release to PyPI HOT 6
- Clean up for releasing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extmath.