Skip to content

Header based cross platform math library πŸ“š for C++, similar to Numpy and Pandas from Python 🐍

License

Notifications You must be signed in to change notification settings

harith-alsafi/mcpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

License: GPL v3 Version Doc Cmake build Dokcer build CodeQL Github Issues

Table of content

Features

  • mcpp (Math for C Plus Plus) is cross platform, templated math library that can be used without compiling .
  • It is targeted towards engineers and mathematicians.
  • Used with a very simple and intuitive syntax inspired from Python libraries such as sympy, numpy, scipy .. etc
  • By only including mcpp.hpp file you get all the functions with their implementations into your code
  • Unit testing is done using Google test
  • Main targeted math sectors :
    • Algebra
    • Statistics
    • Calculus
    • Vectors
    • Signal systems

Compiling

  • There is NO NEED FOR COMPILING just include the header files right away.
  • You can use the compiling procedure to install everything to your standard path
  • The compiling procedure is only used for the test scripts
  • Tested Platforms
    • Linux Ubuntu 18.04
    • macOS 10.13 with xcode 9.4.1
    • Windows 10 version 1809
  • Dependencies
    • cmake version 3.13 or higher
    • GNU c++ compiler version 6.1 ot higher (C++ 14 features)
    • GNU make version 4.1 or higher

Linux Compilation

  • Run the following script or follow the steps below (this will install the header files into your system)
cd scripts
chmod 755 linux.sh
./linux.sh # Will also install new version of cmake 
  1. Cmake new version (if needed)
CMAKE_URL="https://cmake.org/files/v3.19/cmake-3.19.0-Linux-x86_64.tar.gz"
mkdir cmake && wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake 
  1. Build
mkdir build
cd build
# or use ../cmake/bin/cmake .. -DNO-TEST=True 
cmake .. -DNO-TEST=True
make
sudo make install # (this will install the header files into your system)

Macos Compilation

  • Run the following script or follow the steps below (this will install the header files into your system)
cd scripts
chmod 755 macos.sh
./macos.sh
  1. Normal build
mkdir build
cd build
cmake .. -DNO-TEST=True  
make
sudo make install # (this will install the header files into your system)

Windows Compilation

  • Run the following script or follow the steps below (this will install the header files into your system)
.\windows.ps1
  1. Install chocolatey (if not installed)
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  1. Install C++ compilers (if needed)
choco install mingw
choco install cmake
choco install make
choco install gsudo
  1. Building
mkdir build
cd build
cmake -G "Unix Makefiles" .. -DNO-TEST=True
make 
sudo make install # (this will install the header files into your system)

Compilation flags

  • Enable Unit tests
    cmake .. -DNO-TEST=False
    

Usage

  • Non standard path install (means didn't use cmake install)

    #include "includes/mcpp.hpp"
  • Standard path install

    #include <mcpp.hpp>
  • Please see the full documentation for detailed usage on the classes and functions

  • You can see the class refrence as a pdf or an html