Giter Club home page Giter Club logo

thirdhomework's Introduction

Third Homework Report

Overview

In this homework I've implemented some matrix operations using Python, Numpy and C++ with Python ctypes library. After that I've measured time it took for the programs to run.

Measurements Table


     Pure Python    Ctypes     Numpy
5       0.000198  0.000591  0.000129
10      0.001059  0.000794  0.000125
30      0.014069  0.002360  0.000168
50      0.044353  0.002713  0.000188
70      0.066294  0.004671  0.000372
90      0.139928  0.009154  0.000961
110     0.241682  0.011749  0.001231
150     0.590638  0.022036  0.002671
200     1.371608  0.041037  0.006343

Execution time for different for matrices with different size parameter.

Plots

plot

  1. Comparison of all implementations.

plot

  1. Python Numpy vs Python ctypes implementations.

Conclusions

The result clearly suggests that numpy implementation is the fastest one here. It was not a surprise for me to see that Python implementation is extremely slow in comparison to other two. However, I should notice here that my C++ implementation doesn't use parallelism techniques and I suppose that it can be improved by utilizing it. Still I guess there is a case where naive C++ implementation could be faster than numpy - is when matrix size is relatively small, even thought numpy matrix multiplication implementation has O(N^(2.3)) complexity and naive implementation has O(N^(3) complexity, numpy has a big constant in its complexity.

thirdhomework's People

Contributors

ferenecruma avatar

Watchers

James Cloos 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.