Code Monkey home page Code Monkey logo

ndseqpy's Introduction

ndseqpy

Yet another n-dimensional sequence implementation with subclasses for list, bytearray, array.array and ctypes.

Included in claases are:

  • NDArray -- an ndim array.array implementation
  • NDByteArray -- an ndim bytearray implementation
  • NDList -- an ndim list implementation

Abstract classes:

  • NDSequence -- an abstract sequence wrapper for enabling ndimensions
  • SequenceView -- a view getter, setter and len using the base class methods

Mixin classes:

  • NDMath -- mixin operations for doing sequence item math.

example

>>> import ndseq as nd
>>> ndba = nd.NDByteArray( ((0,1,2),(3,4,5),(6,7,8)) )
>>> ndba[0,0]
(0,)
>>> ndba[:,0]
(0, 3, 6)
>>> ndba[0,:]
(0, 1, 2)
>>> ndba.flat[1:8]
bytearray(b'\x01\x02\x03\x04\x05\x06\x07')
>>> ndba[1,:] = (10,11,12)
>>> ndba
NDByteArray(b'\x00\x01\x02\n\x0b\x0c\x06\x07\x08')
>>> ndba.flat[0:2]
bytearray(b'\x00\x01')
>>> ndba.flat[0:2] = (100,100)
>>> ndba
NDByteArray(b'dd\x02\n\x0b\x0c\x06\x07\x08')

ndseqpy's People

Contributors

ismaelharunid avatar

Stargazers

 avatar  avatar

Watchers

 avatar

ndseqpy's Issues

Currently NDByteArray can only contain bytes, should it do more? Either way some...

Currently NDByteArray can only contain bytes, should it do more? Either way some potential base classes will uses bytes and NDSequence should be capable of converting bytes to itemtype an vica versa.

As part of that we need to make a distinction and rename of strides which currently refers to item strides. There should be both itemstrides and bytestrides. Make it so.

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.