Giter Site home page Giter Site logo

matrixalgo's Introduction

Matrix Algorithms

The repository contains the implementation of Matrices in C and will follow two approaches:

  1. Using 2D Arrays: The matrix uses a double pointer and is more intuitive to use.
  2. Using a Single Array: The matrix uses a single pointer and is more memory efficient.

The repository will contain the following operations:

  1. Matrix Addition
  2. Matrix Subtraction
  3. Matrix Multiplication
  4. Scalar Matrix Multiplication
  5. Transposition
  6. Determinant
  7. Inverse
  8. Rank
  9. Trace
  10. Eigenvalues and Eigenvectors
  11. LU Decomposition
  12. RREF
  13. Solving Linear Equations

The goal is to be able to port this to the MufiZ project, but also provide this as a standalone library, for anyone who wants to use it.

Readings

When computing RREF, to keep numerical stability we will need to use the method of partial pivoting.

MMUL Bench

In bench.c we created a benchmark file that will do matrix multipliciation between a 1000 x 1000 matrix, we get the following results:

# no flags
$ gcc bench.c src/matrix.c -o bench
$ ./bench
Time taken by mmul1: 4.488451 seconds
Time taken by mmul2: 2.904525 seconds
# with flags
$ gcc bench.c src/matrix.c -o bench -Wall -ffast-math -O3 -Werror -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-value
$ ./bench
Time taken by mmul1: 2.093212 seconds
Time taken by mmul2: 0.701268 seconds

As we can see, the second implementation can perform close to 2x better. Although, it would also be great to check other metrics such as heap usage, and cache hitting.

matrixalgo's People

Contributors

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