Giter VIP home page Giter VIP logo

ublas-programming-competency-test's Introduction

Simple Matrix Library

A simple matrix library that use expression templates and modern concepts of C++ to solve algebric expressions. This project is built for Programming Competency Test under GSoC2O19/Boost/uBLAS.

Prerequisites

Clang -v 7.0.1 or greater

Using this Library

1. Clone the repository.

git clone https://github.com/NavneetSurana/uBLAS-Programming-Competency-Test.git

2. Include lazy_matrix.h in your source file.

#include"path-to-the-cloned-repo/include/lazy_matrix.h"

3. Use clang compiler for compilation.

clang++ -std=c++17 [your src file name].cpp -o build
./build

Documentation

Please refer to Simple Matrix Library for documentation.

Features

The table below shows various operations that can be performed using this library along with short description.

Operators Expression Templates Used Description
% Yes Performs standard Matrix-Matrix Multiplication
%= No Performs assignment after standard Matrix-Matrix Multiplication
+ Yes Performs element-wise Matrix-Matrix Addition
+= No Performs assignment after element-wise Matrix-Matrix Addition
- Yes Performs element-wise Matrix-Matrix Subtraction
-= No Performs assignment after element-wise Matrix-Matrix Subtraction
/ Yes Performs element-wise Matrix-Matrix Division
/= No Performs assignment after element-wise Matrix-Matrix Division
* Yes Performs element-wise Matrix-Matrix Multiplication
*= No Performs assignment after element-wise Matrix-Matrix Multiplication
= No Performs assignment operation of a given Matrix
== No Performs comparison between a Matrix and any other entity

Efficiency Test

Inorder to know how fast lazy_matrix libraray works I have tested it against traditional way of solving Matrix algebric expressions and the same can be found in trad_matrix.h. Using the test_case_generator.cpp file I have generated some random expression of length 300 involving operators like +,-,/,* and +=. The benchmark.h file has been used for testing and extracting the results of the test. After executing the test using main.cpp file, the results have been conveyed in the plot below. For proof one can see proof.png and for test logs one can see test_logs.txt. From the graph below one can see that Lazy Evaluation is nearly 50% more efficient than the Traditional way of Evaluation.

Note: The test above involved only element-wise operations. The operator % for Standard Matrix-Matrix Multiplication is coded without using temporaries, which unnecessarily increased the complexity due to redundant evaluation of the same elements in link broken. One way to reduce complexity is to evaluate operator % as and when encountered and store the result in a temporary or do something related to optimization of the expression templates tree.

Link Broken

Author

  • Navneet Surana - Some of my works can be viewed at - GitHub
  • Along with this I have also worked on solving 9X9 Sudoku Puzzle using genetic algorithm.

  • Thanks to GitHub for providing such an amazing open-source platform.
  • I hope this project brings in new opportunities for me.

ublas-programming-competency-test's People

Contributors

navneetsurana avatar

Watchers

James Cloos avatar  avatar

Forkers

ssaahhaajj

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.