Giter Site home page Giter Site logo

gci_matrix_multiplication's Introduction

GCI Matrix Multiplication

Matrix multiplication program written in python3 and compared to jit optimized version and numpy.

Usage

matmul.py contains the functions and their numba.jit optimized versions.

time_matmul.py measures the time it takes in seconds to do matrix multiplication on NxN matrices on themeselves. It stores the input size N, and the time it takes to do a matmul on a random NxN matrix by itself, for input sizes from 10 until max argument. The results are stored in:

  • matmul.txt for my matrix multiplication

  • matmul_jit.txt for my matrix multiplication but optimized with numba.jit

  • matmul_numpy.txt for numpy matrix multiplication.

python3 time_matmul.py -h
usage: time_matmul.py [-h] [--jit | --numpy] [max]

Timing matrix multiplication functions. Output saved to matmul.txt,
matmul_jit.txt, matmul_numpy.txt

positional arguments:
  max          loop from 10 with a step of 10 till this number, default is 500

optional arguments:
  -h, --help   show this help message and exit
  --jit, -j    Time the numba jit optimized version of my matmul
  --numpy, -n  Time the numpy version of matmul

display.py renders the measurements from these files using matplotlib

python3 display.py -h
usage: display.py [-h] [--jit] [--numpy] [--normal]

Compare times vs input for matrix multiplication using matplotlib

optional arguments:
  -h, --help    show this help message and exit
  --jit, -j     Display jit
  --numpy, -n   Display numpy
  --normal, -c  Display my matrix multiplication

Results

All

python3 display.py --normal --jit --numpy

All.png

Numpy and my matmul optimized with jit

python3 display.py --jit --numpy

NumpyJit.png

My matmul normally and optimized by jit

python3 display.py --normal --jit

JitNormal.png

My matmul and Numpy matmul

python3 display.py --numpy --normal

NumpyNormal.png

gci_matrix_multiplication's People

Contributors

wmstack avatar

Watchers

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