Skip to content

A header-only template library with implementation of Linear Algebra tools and methods for C++

License

Notifications You must be signed in to change notification settings

sergeyshor/Linear-Algebra-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linear-Algebra-Library

A header-only template library with implementation of Linear Algebra tools and methods for C++

Table of Contents

About

Linear Algebra Library is a C++ project that provides access to different Linear Algebra tools and methods. It can be used in other projects or to help students understand and learn Linear Algebra.

Current version of library contains:

  • Own Matrix class with different methods to operate with it;
  • Different methods to solve a system of linear equations;
  • And some other functions.

Full list of tools and methods can be viewed in Documentation.

I am looking forward to add new functionality soon such as:

  • Boolean (binary) Matrix implementation;
  • Matrix class iterator;
  • Vector class;
  • New methods to solve system of linear equations;
  • Complex number class.

License

License: MIT

Requirements

Linear Algebra Library requires C++14 standard or newer.

Build System

Testing Framework

Installation

1. Clone the repository from GitHub

PATH = path to clone repository

>> cd <PATH>
>> git clone --recursive https://github.com/sergeyshor/Linear-Algebra-Library.git

2. Build installed products using CMake

>> cd Linear-Algebra-Library
>> mkdir build
>> cd build
>> cmake ..

3. Install the includes and CMake target files

You may need to open a command prompt with admin privileges on Windows. You should run the following command with sudo on Linux.

>> cmake --build .

4. Run the tests (Optional)

>> cd test/Debug

Windows

>> LinearAlgebraTest.exe

Linux

>> ./LinearAlgebraTest

Building

1. Create the source file

#include <iostream>
#include <LinearAlgebra.hpp>

int main() 
{
    LinAlg::Matrix<double> matrix = { { -11, 5, 4 }, { 8, 0, 31 }, { 27, -3, 16 } };
    std::cout << matrix.determinant() << '\n'; // matrix determinant calculation
    return 0;
}

2. Create the CMakeLists.txt file

cmake_minimum_required(VERSION 3.23.2)

project(MainProject LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 14)

set(Sources main.cpp)

add_executable(MainProject ${Sources})

add_subdirectory(Linear-Algebra-Library)

target_link_libraries(
    MainProject
    Linear-Algebra-Library
)

3. Build the project

SRC_PATH = path to created CMakeLists.txt and main.cpp files

>> cd <SRC_PATH>
>> mkdir build
>> cd build
>> cmake ..
>> cmake --build . --config Release

4. Run the executable file

>> cd Release

Windows

>> MainProject.exe

Linux

>> ./MainProject