Git Product home page Git Product logo

linear-algebra-library's Introduction

A Custom linear algebra library


Motivation

The reason for building this project was to implement the common linear algebra algorithms that were introduced during the introductory linear algebra course during my freshman year


Demo


$$2x+5y+z=20$$

$$4x+5y+z=10$$

$$6x+5y=0$$

$$A = \begin{pmatrix} 2 & 5 & 1 \\ 4 & 5 & 1 \\ 6 & 5 & 0 \\ \end{pmatrix} $$

$$B = \begin{pmatrix} 20 \\ 10 \\ 0\\ \end{pmatrix}$$

$$Solution => x=-5,y=6,z=0$$



./images/gif.gif

What can it do?


API:

  • Create a new matrix:
    • mat* mat_new(unsigned int num_rows,unsigned int num_cols)
    • Assigning values: mat->data[row][col] = desired_value
  • Free a created matrix:
    • void mat_free(mat* matrix)
  • Create a matrix with random numbers
    • mat *mat_rnd(unsigned int num_rows, unsigned int num_cols, int min, int max)
  • Generate a square matrix
    • mat *mat_sqr(unsigned int rowCol)
    • Assigning values: mat->data[row][col] = desired_value
  • Generate a square random matrix
    • mat *mat_sqr_rnd(unsigned int rowCol, int min, int max
  • Matrix addition
    • mat* mat_add(mat* a,mat* b)
  • Matrix subtraction
    • mat* mat_subtract(mat* a,mat* b)
  • Matrix multiplication
    • mat* mat_mul_naive(mat* a,mat* b)
  • Finding Row Echelon Form of a Matrix
    • mat* mat_ref(mat* a)
  • Finding Reduced Row Echelon Form of a Matrix
    • mat* mat_rref(mat* a)
  • LU decomposition
    • mat_lup* mat_LU(mat* a)
  • Solving linear equations
    • mat* solve_linear_LU(mat* a,mat* b)
  • Finding the inverse
    • Using LU method
      • mat* mat_inverse(mat* a)
  • Finding the determinant
    • double mat_determinant(mat* a)

Background and References


Can this be used in production?


Definitely not. This project was build for educational purposes only and this is definitely not a library that one should use for their projects.

Future of this project


  • This project is far from complete.
  • Some new features to be implemented:
    • A CLI interface for users
    • Replacing current makefile with CMake
    • Computing eigenvalues and eignevectors
    • Adding faster algorithms and better data structures
      • Addition of strassen's algorithm for matrix multiplicaton
      • Dense and sparse matrices
      • More...

linear-algebra-library's People

Contributors

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