Giter Club home page Giter Club logo

numpy-cursor's Introduction

NumPy Cursor

This repository contains a Python implementation of a cursor for NumPy matrices. The cursor allows you to conveniently move through a matrix and read or modify its values.

The cursor class has the following methods:

  • __init__(self, matrix): Initializes the cursor with a NumPy matrix.
  • left(self, steps=1): Moves the cursor left by steps columns.
  • right(self, steps=1): Moves the cursor right by steps columns.
  • up(self, steps=1): Moves the cursor up by steps rows.
  • down(self, steps=1): Moves the cursor down by steps rows.
  • move(self, row_steps, col_steps): Moves the cursor by row_steps rows and col_steps columns.
  • set(self, row, col): Set the cursor by row rows and col columns.
  • coordinates: Returns the current row and column coordinates of the cursor.
  • isEmpty: Returns True if the value of the matrix at the current cursor position is zero, and False otherwise.
  • setItem(self, item): Setting the value of the cursor cell by item.
  • __repr__(self): Returns a string representation of the value of the matrix at the current cursor position.
  • __str__(self): Returns a string representation of the value of the matrix at the current cursor position.

The implementation also includes error checking to prevent moving the cursor beyond the boundaries of the matrix.

numpy-cursor's People

Contributors

ndfadeev avatar nikgariel avatar

Watchers

Kostas Georgiou avatar  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.