Skip to content

CihatAltiparmak/Matrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Matrix Library

love

This matrix library is the library that create matrix easily and perform various matrix operations for cpp.

Table of contents

Installation

This Project is still under construction. But it is set installation with cmake.

To install the Matrix library, just run

$ git clone https://github.com/CihatAltiparmak/Matrix.git
$ cd Matrix
$ mkdir build && cd build
$ cmake ..
$ sudo make install

These commands will setup Matrix library to /usr/local/include and /usr/local/lib

To see files that are installed, run

$ cat install_manifest.txt

To uninstall this library

$ xarg rm < install_manifest.txt

To use this library in your project, you can compile like this

main.cpp

#include <iostream>
#include <vector>

#include <atrix/matrix.h>
#include <atrix/linalg/algorithms.h>
#include <atrix/linalg/decompositions.h>

void print_m(Matrix::Matrix<double> A) {

    for (int x = 0; x < 3; x++) {
        for (int y = 0; y < 3; y++)
            std::cout << A(x, y) << " ";
        std::cout << std::endl;
    }
}

void print_m1(Matrix::Vector<double> A) {

    for (int x = 0; x < 3; x++)
        std::cout << A(x, 0) << " ";
    std::cout << std::endl;
}

int main()
{

    Matrix::Matrix<double> A(3, 3);
    Matrix::Matrix<double> C = Matrix::zeros<double>(3, 3);

    print_m(A);
    std::cout << "*********************" << std::endl;

    auto X = Matrix::to_column_vectors(A);

    for (auto v : X) {
        print_m1(v);
        std::cout << "###########" << std::endl;
    }

    A(0, 0) = 100;
    A(1, 0) = -100;
    A(2, 0) = 0;

    return 0;

}

Compile command

g++ main.cpp -o main -std=c++17 -g

Testing

The unit testing of this project is not finished yet. But the unit testings for matrix.h and vector.h are ok. To test this project,

$ cd test
$ mkdir build && cd build
$ cmake ..
$ make

Now, we can run test executable files.

$ ./matrix_test
$ ./vector_test 

Documentation

The matrix library documentation is only inside source code of this repo now. But the wiki of this repo is going to be edited for documentation. In addition, you can look into test directory.

Benchmarks

The benchmarks are not finished yet, but now, there is just the benchmark of matrix.cpp. For benchmarking

$ cd benchmark
$ mkdir build && cd build
$ cmake ..
$ make

And finally,

$ ./matrix_benchmark

The benchmarkings take a long time.

Getting Help

You can open issue here or you can mail to me.

Contribute

It is going to be added soon

Code Contributors

GitHub Contributors Image

License

This repo is under MIT LICENSE

TODO

  • Add benchmark for all functions and methods in this repo.
  • Add decomposition functions, functions that convert a matrix to row-echelon and reduced row echelon form.
  • Add assertions for some functions.
  • Add augment function for operations like [A | I] here
  • Refactor the function inv there if you can augment function.
  • You can add the functions for eigen values.
  • Edit the wiki of this project.
  • Edit the README.md of this project.
  • Add test option for this repo (insufficient)
  • Add python bindings (That's not importart. It's not priority for us now)

Third Party Libraries

  • It is not used third party library in this repo.

About

The Matrix Library for Cpp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published