• Stars
    star
    3
  • Rank 3,963,521 (Top 79 %)
  • Language
    C++
  • License
    The Unlicense
  • Created almost 4 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A matrix header-only library, uses graphs internally, helpful when your matrix is part of a simulation where it needs to grow many times (or auto expand)

GraphMat

Header-only Library

Matrix implemented as a graph, specially for the use case when it should be auto expanding at custom rate, specially in simulations. A matrix header-only library, uses graphs internally, helpful when your matrix is part of a simulation where it needs to grow many times (or just automatically keep growing).

Tip: Can directly go to the documentaion in the wiki section for usage

This was originally a subproject for the worldline project

Purpose -

I needed a matrix like data structure, that can have

  1. Expansion and deletetion capabilities like that of a list (ie. no need to copy again and again for expansion as in std::vector (and i am not talking about the capacity vs size here, that would not work for my purpose))

  2. access as a vector 2x2 matrix, or atleast fast access

Then, i had read somewhere, A matrix is inherently a graph, each node connected to 4 adjacent nodes, though it maybe very simple, but quite intutive it seems.

So, now the point of it, So i created a matrix data structure, based on a graph, that completes the requirements for point 1 above, though it doesn't have constant time lookups like std::vector, but for my case, i chose to create it like this.

Basic Usage

...
#include <graphMat/graph_mat.hpp>

int main(){
    Graph_Matrix_3D<int> matrix;            // primitive type
    Graph_Matrix_3D<std::string> smat;      // objects
    Graph_Matrix_3D<DataClass> dmat({5, 5, 5}); // initial size
    Graph_Matrix_3D<DataClass> dmat({5, 5, 5}, [n=1](DataClass& data, int x, int y, int z) mutable {    // size with INITIALISIZER function (other variants exist too)
        data.my_data_member = 100*x + 10*y + z;
        std::cout << "Adding box: " << n++ << '\n';
    });
}

Documentation

Documentation is being maintained in wiki section of this repo.

https://github.com/adi-g15/graphMat/wiki/Graph-Matrix-3D

Note -

You can likely just use a std::list<std::list<std::list>>, though then memory allocations will be for each node individually, and also i wanted a better structure according to the needs of worldLine Simulation project, auto expansion being one.

Also, in case of vector<vector<vector<>>>, you will likely have it grow in ONLY TWO DIRECTIONS, and I WANTED IT TO GROW EQUALLY IN ALL FOUR DIRECTIONS, now this would, almost always mean, that even for a simple expansion, the vector<vector<vector<>>> has to completely allocate to a whole new place

Created by Aditya Gupta :D, it follows the Unlicense license, no restrictions for you :-)

More Repositories

1

Ludo-The_Game

An implementation of the famous board game Ludo, using C++
C++
25
star
2

worldLineSim

Think about a world, in which many entities keep moving(action) automatically, and you can go back in time to change the state, hence the current and the future
C++
11
star
3

minor-project-vanet

Simulating communication in a VANET (Vehicular Ad-Hoc Networks), and implementing access control, using concepts from blockchains, maintaining privacy of connected vehicles too.
C++
11
star
4

leetcode-progress-tracker

Fetch and graph your progress from leetcode
TypeScript
7
star
5

bluetooth-util-lib

Bluetooth File transfer, BLE peripherals, and central, using bluez5 DBus API
C++
5
star
6

saras

Writing a basic compiler frontend following LLVM's tutorial, with complete added supports Hindi/Telugu and UTF-8 in general
C++
5
star
7

notes

My notes, about some technologies, the ones i made digital notes of
Assembly
5
star
8

AttendancePortal

Attendance Portal WebApp using GPS and Voice verification (using MS CognitiveServices). Put together by DevHack1.0 team.
HTML
4
star
9

CS7479

Decrypted Notes for Distributed Systems. Fully automated, your Zero Intervention. Code can be used for others, PDFs only accessible by students of NIT Patna, India.
Python
4
star
10

simplecpp

A simple graphics library in C++.
C++
3
star
11

sawtooth-intkey

Slightly modified Sawtooth intkey code, in C++, Rust, Javascript and Python
C++
3
star
12

cpproj

C++ Project Management tool
C++
2
star
13

Quantum-Algorithms---Shor-Minor-Project-2

Quantum Algorithm - Shor (Minor Project 2)
TeX
2
star
14

the-os-cashier

Envisioning a shared computer, with decentralised control, instead of an admin-based configuation; an application that runs on Sawtooth blockchain
Rust
2
star
15

ankit-neet-bonds-checker

Checks your choices in MCC NEET counselling choice filling, for bonds.
TypeScript
2
star
16

zeeve-learnings

Zeeve Internship - Projects and Learnings
2
star
17

LetsShareLAN

A simpler and better way to log in the NITP LAN, with randomly chosen credentials to distribute unused data to those in need
Python
2
star
18

NoCaptive

[Deprecated] Python Script to automate login to captive portal, no browser needed, auto logouts. IMPROVED VERSION AT:
Python
2
star
19

languages-coexistence

Coexistence of C, C++, Rust, Python and JavaScript; Cryptography; Communication using bindgen, FFI, REST(HTTP), gRPC and zmq (TCP)
CMake
1
star
20

leetcode-practice-queue

Keeps track of your 'to practice' list of leetcode questions
Rust
1
star
21

CSV_Tabler

A small C++ project that stores contacts from csv with all data into vectors and objects, used to reduce contacts
C++
1
star
22

utilpp

Utility Functions and Classes...
C++
1
star
23

minor-project-1

Access Control in Vehicular Ad-hoc NETwork (VANET)
Shell
1
star
24

assembly_stopwatch

Stopwatch written in assembly, a for fun project
Assembly
1
star
25

ipl_pred

Calculates the mathematical chances of each team qualifying for playoffs in Indian Premier League 🏏🏏
Rust
1
star
26

kharcha

Tool to automate expense summary from SBI, HDFC, Amazon Pay statements.
JavaScript
1
star
27

adi-g15.github.io

My Portfolio, template from html5up
CSS
1
star
28

custom-consensus-engine

[WIP] Reference implementation for a custom consensus engine for sawtooth blockchain
Rust
1
star
29

Spot_2_Gaana

This is aimed to get list of favourite songs from your spotify library ( with little modification, it can work for any playlist ), then searches them on Gaana (another music platform) and, if found, favourites them, so as to add them to its liked songs
Python
1
star
30

Attendance_Register

A Project, that basically takes care of your attendance, at the same time, it's quite advanced due to a strong foundation by the 'TimetableManager', more in ReadMe
C++
1
star
31

CS4401

Decrypted Notes for NIT Patna 2k19-23 Batch
TypeScript
1
star
32

devel-arch

Dockerfile based on archlinux:base-devel, with additional user and packages
Dockerfile
1
star
33

sudokuSolver_Optimized

An optimised multi-threaded backtracking sudoku solver, that only iterates for the narrowed down possibilities, includes usual simple unoptimized backtracking too
C++
1
star