Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future vision: closing current as Farray1, and proceeding to Farray and NFarray #3

Open
tomhea opened this issue Nov 28, 2020 · 1 comment
Labels
Backlog Not planned to be implemented soon enhancement New feature or request

Comments

@tomhea
Copy link
Owner

tomhea commented Nov 28, 2020

First of all - Farray stands for Fillable array.

As I see it - the final project should have 3 main classes, and one namespace:

file farray1.hpp:

  • namespace Farray1Direct - should hold the 1bit implementation of fill, read, write, writtenSize, begin/end (with an interior namespace for the interior functions).
  • class Farray1 - The wrapper for the 1bit functions ([], =, iterator, no need for A,n,flag each time).

file farray.hpp:

  • class Farray - The implementation of the log(n) bits (b and def outside), with all ([], =, iterator, ...).

file nfarray.hpp:

  • class NFarray : public Farray - extends Farray with numerical features. ++,--,+=,-=,*=,/= (for proxy, and for whole Array), and maintaining the sum of all vars. All ops should still be O(1).

All classes shouldn't be under any namespace.


It should all start by closing the current project as farray1.hpp. The iterator's begin/end should be implemented in the namespace area, while the Holder/Farray1 class should only contain wrapper begin/end to the direct ones.

Then iterators should be automatically tested (not printable tests), for the direct and wrapping iterators both.

Then the file's, class', and namespace's names should be changed, the project's README should be updated, and the project's name should be set to Farray.
Also - the tests.cpp should just call tests_farray1.cpp, which will hold all the logic.


Only then, the Farray should be born.

The Farray would hold more bytes in memory but will be faster, as each write will init a smaller block (for int:32 vs size_t:64 - 2.5 smaller).

The farray.hpp and tests_farray.cpp should be mainly based on farray1.hpp and tests_farray1.cpp.

The farray.hpp should be simplified as much as it can, and also contain options for other sizes (not just size_t) in a templated fashion.

Then after many testing (tests.cpp should also call tests_farray.cpp of course), and README update:


The NFarray should come to life (stands for Numerical Fillable array).

It should have a ++,--,+=,-=,*=,/= for the proxy, and also ++,--,+=,-=,*=,/= for the NFarray instance (update all at once). The += for example is meant for adding a T variable to the proxy (or to all of the array's elements).
Also, It will feature a sum() O(1) operation to retrieve the sum of the whole array (by maintaining a sum var).

Doing that for the whole array is by saving x,y for each NFarray instance, s.t. new_read(A, i) returns x*read(A,i)+y, while new_write(A, i, v) does write(A, i, (v-y)/x).

I'll just remind future someone to execute fill(0) instead of *=0, because otherwise it will cause some problems with writing new values (div by 0).
And just remember - user caused overflow is not our concern, so no need to check for those.

Then NFarray should be tested (in tests_nfarray.cpp also called from tests.cpp), and the README should be updated.


Then, and Only Then, The Farray project should be complete.

@tomhea
Copy link
Owner Author

tomhea commented Dec 7, 2020

Farray1 Complete!

The farray1.hpp and whole Farray1 changes are done.

I created a Wiki Page, filled with short paper explanation (written first at readme), advanced features (half new, half from readme), space&time analysis (all new), and project structure (part of it taken from this issue).

I edited the readme accordingly.


Now, let's go to Farray!

The next part will be to copy the farray1.hpp, and the farray1 tests/timings/output, and creating the farray.hpp and other files accordingly.

Then Testing, timing, and editing the readme and the Wiki.

@tomhea tomhea modified the milestones: Farray1 Complete!, Wiki Opened Dec 7, 2020
@tomhea tomhea added Backlog Not planned to be implemented soon enhancement New feature or request labels Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backlog Not planned to be implemented soon enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant