/Matrix-library

Primary LanguageC++MIT LicenseMIT

Matrix-library

Matrix-library is a C++ library for dealing with matrices.

Getting Started

Prerequisites

To use cmake, make sure cmake is installed. If it not installed use these commands to install that:

sudo apt-get install cmake

Make a static library

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)" .

Make a shared library

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.

Usage

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;
}

The functions you can use are:

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.

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.

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.

License

MIT