Code Monkey home page Code Monkey logo

farray's Introduction

Snake Animation Snake Animation

No activity tracked

farray's People

Contributors

tomhea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

dumblob sondro

farray's Issues

Get rid of exceptions (or make them optional)

Many core systems nowadays expect single-header libs or generally low-level libs to not be dependent on C++ exceptions.

So to make this lib more appealing I propose to make it exception-less by default (or at least optionally exception-less).

Add example projects

Add an example folder with example code using the direct-functions, and the Farray1, Farray, and NFarray classes.

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

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.

simplify README

Add the new features - operator[] read/write, operator= fill, written-indices iterator, to README.

The old read/write should only be seen in the direct function mode.

The readme should be use a simple and main example.

use Jekyll

Start creating the Farray GitHub-pages site locally, and use the following plugins:

  • Jekyll-sitemap
  • minimal-mistakes (theme)
  • Simple-Jekyll-Search

And find a solution for a normal sidebar and simple navigation in the website.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.