Giter Site home page Giter Site logo

christianbender / linear-algebra-python Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 56 KB

This module contains some useful classes and functions for dealing with linear algebra in python 2.

License: MIT License

Python 100.00%
linear-algebra linear algebra python lib module library mit-license mit vector

linear-algebra-python's Introduction

Linear algebra library for Python

This module contains some useful classes and functions for dealing with linear algebra in python 2.


Overview

  • class Vector

    • This class represents a vector of arbitray size and operations on it.

    Overview about the methods:

    • constructor(components : list) : init the vector
    • set(components : list) : changes the vector components.
    • str() : toString method
    • component(i : int): gets the i-th component (start by 0)
    • size() : gets the size of the vector (number of components)
    • euclidLength() : returns the eulidean length of the vector.
    • operator + : vector addition
    • operator - : vector subtraction
    • operator * : scalar multiplication and dot product
    • operator == : returns true if the vectors are equal otherwise false.
    • copy() : copies this vector and returns it.
    • changeComponent(pos,value) : changes the specified component.
    • norm() : normalizes this vector and returns it.
  • function zeroVector(dimension)

    • returns a zero vector of 'dimension'
  • function unitBasisVector(dimension,pos)

    • returns a unit basis vector with a One at index 'pos' (indexing at 0)
  • function axpy(scalar,vector1,vector2)

    • computes the axpy operation
  • function randomVector(N,a,b)

    • returns a random vector of size N, with random integer components between 'a' and 'b'.
  • class Matrix

    • This class represents a matrix of arbitrary size and operations on it.

    Overview about the methods:

    • str() : returns a string representation
    • operator * : implements the matrix vector multiplication
      implements the matrix-scalar multiplication.
    • changeComponent(x,y,value) : changes the specified component.
    • component(x,y) : returns the specified component.
    • width() : returns the width of the matrix
    • height() : returns the height of the matrix
    • operator + : implements the matrix-addition.
    • operator - : implements the matrix-subtraction
    • operator == : returns true if the matrices are equal otherwise false.
    • operator * : computes the scalar-product, the matrix-vector product and the matrix-matrix multiplication.
  • function squareZeroMatrix(N)

    • returns a square zero-matrix of dimension NxN
  • function randomMatrix(W,H,a,b)

    • returns a random matrix WxH with integer components between 'a' and 'b'
  • function zeroMatrix(rows, cols)

    • returns a zero matrix of size rows x cols.

Documentation

The module is well documented. You can use the python in-built help(...) function.
For instance: help(Vector) gives you all information about the Vector-class.
Or help(unitBasisVector) gives you all information you needed about the
global function unitBasisVector(...). If you need informations about a certain
method you type help(CLASSNAME.METHODNAME).


Usage

You will find the module in the src directory its called lib.py. You need to
import this module in your project. Alternative you can also use the file lib.pyc in python-bytecode.


Tests

In the src directory you also find the test-suite, its called tests.py.
The test-suite uses the built-in python-test-framework unittest.

linear-algebra-python's People

Contributors

christianbender avatar

Stargazers

 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.