Matrix-library is a C++ library for dealing with matrices.
To use cmake, make sure cmake is installed. If it not installed use these commands to install that:
sudo apt-get install cmake
To make a static library you need to cmake the CMakeLists.txt and then change directory to CMakeFiles and make the Makefile.
cmake CMakeLists
cd CMakeFiles
make
Now ".a" file made. To use this ".a" file you can link this file with your mian file with "g++ -L(location of header file) -l(.a name)" .
To make a shared library you need to change CMakeFiles to this:
cmake_minimum_required(VERSION 3.5)
project(Matrixlib)
set(CMAKE_CXX_STANDARD 14)
add_library(Matrixlib SHARED matrixLib.cpp matrixLib.h)
Now ".so" file made.
To use this ".so" file you can check this link.
A simple code to check my library:
#include "matrixLib.h"
using namespace std;
int main()
{
Matrix matrix1(2,3); //Make a 2,3 matrix
cin >> matrix1; //Get the elements of matrix from user
cout << "your matrix is:\n" << matrix1; // print the matrix1
return 0;
}
This constructor will take the address of your matrix text file and then make a that matrix.
This constructor will get row and column of your matirx and make that matrix.
Overloading ">>" to take elements of matrix from input.
Overloading "<<" to print the matrix.
friend Matrix operator * (int const coefficient, Matrix const matrix) and Matrix operator * (int const coefficient) :
These funtions Multiply the matrix in the coefficient return a "Matrix" object.
These function print the matrix with/without a specific delimiter.
This function sum the matrices return a "Matrix" object.
This function subtract the matrices return a "Matrix" object.
This function multiply the matrices and return a "Matrix" object.
This function compares matrices and return a "bool" value.
This function transpose the matrices and return a "Matrix" object.
This function compute the determinant of the matrices and return a "double" value.
This function save the matrices in a textfile with a specific delimiter.
int getRow() and int getColumn() :
These functions show the row/column of matrices and return a "int" value.
This function return a "string" that show the row and column of matrices.
This function compute the inverse of the matrices and return a "Matrix" object.