Skip to content

Neurofibromin/qvmlbr

Repository files navigation

qvlmbr

Matrix and graph library in c++23.

Matrix Library

The library provides a Matrix class that supports matrices of arbitrary size and type.

General Operations:

  • Matrix addition and multiplication
  • Transpose formation
  • Rank calculation
  • Solving systems of linear equations

Operations for Square Matrices:

  • Inverse calculation
  • Matrix exponentiation using the repeated squaring method
  • Determinant calculation (using Bareiss or Gaussian elimination)
  • Trace calculation

Graph Library

The Graph class is implemented using an adjacency matrix representation. It supports weighted, directed, and undirected graphs.

Implemented Algorithms:

  • Breadth-First Search
  • Depth-First Search
  • Dijkstra's algorithm for finding the shortest path
  • Topological sort for directed acyclic graphs
  • Eulerian circuit, acyclicity, symmetry, and connectivity checks

Data Structures

The project implements several fundamental data structures with similar behaviour to the STL containers:

  • Matrix
  • Graph
  • Fraction
  • Vector
  • Pair
  • Queue
  • Stackvector: A hybrid vector that utilizes stack memory for small sizes before allocating on the heap.

Building the Project

mkdir build && cd build && cmake ..
make
./qvmlbr

Running Tests

The project includes a suite of tests using the gtest framework. To build and run the tests:

mkdir _build && cd _build && cmake ..
make
./test/qvmlbr_tests

Input File Format

The library supports reading matrices from text files. The format is as follows:

  • Matrix elements in a row are separated by spaces.
  • Rows are separated by newlines.
  • Each row in a matrix must have the same number of elements.
  • Multiple matrices in a single file must be separated by at least one empty line.

An example of a valid input file containing two matrices:

1 2 3
4 5 6

10 20
30 40

License

This project, including its source code and documentation, is licensed under the GPL-3.0 license.

About

Quick and Versatile Matrix LiBRary

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors