Git Product home page Git Product logo

ndarray's Introduction

ndarray

This is a simple single header implementation of n-dimensional array in C++11 standard. The storage layout is column major (same as Fortran/Matlab). Current implementation only supports limited features. More features will be added in the future, ie. iterator.

Installation

Simply include the header in your source file to use.

Documentation

Many member functions of ndarray accept variable length argument. Safe and efficient variable length argument is implemented using initializer_list.

To use debug features such as boundary check, add #define _DEBUG at the beginning of header or use compiler flag -D_DEBUG.

Some major usage of ndarray are listed below:

  1. Declare array

    ndarray <double> a(); //declare empty array
    ndarray <double> a({2,2,2}); //declare an ndarray using inializer_list with number of element in each dimension
  2. Use setup to create a new array

    a.Setup({0,0,1});
  3. Initialize array elements to value

    a=5.;
  4. Access/set array element

    a({0,0,1}); //access/set using initializer_list
    a(1); //access/set as if the array is 1D array
  5. Get pointer of array element

    a.GetData({0,0,1}); //get pointer using initializer_list
    a.GetData(1); //get pointer as if the array is 1D array
  6. Reshape array

    a.Reshape({1,4,2}); //reshape using initializer_list

License

MIT License

ndarray's People

Contributors

weiqishen avatar

Watchers

 avatar

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.