Skip to content

abdallahsoliman00/NumXX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

A C++ header-only library inspired by NumPy.

(Compatible with C++17 and above)

Tabe of Contents

  1. Overview
  2. How To Use
  3. Project Status
  4. More Documentation
  5. Contribution
  6. Disclaimer

Overview

NumXX is an implementation of NumPy in C++. It hopes to bring about the easy number and array manipulation found in NumPy ... but in C++.

How To Use

This library was made completely in vanilla C++, so using it should be simple. There are two ways:

Method 1:

  • Simply clone this repository:
git clone https://github.com/abdallahsoliman00/NumXX.git
  • Add the folder NumXX to your include path.
  • To use, add the following line to the top of your C++ file:
#include "NumXX.hpp"

Method 2:

  • Add the following to your CMakeLists.txt project file:
# Fetch NumXX from GitHub
include(FetchContent)

FetchContent_Declare(
    NumXX
    GIT_REPOSITORY https://github.com/abdallahsoliman00/NumXX.git
    GIT_TAG main
)

FetchContent_MakeAvailable(NumXX)

# Link library
target_link_libraries(${PROJECT_NAME}
    PRIVATE
    NumXX
)
  • You can now use the library by adding the following:
#include <NumXX.hpp>

Project Status

This project is complete with *mostly all the core features.
These include:

  • Easy array creation for any number of dimensions
  • Element-wise operations
  • Array slicing
  • Basic matrix and vector operations (see here)
  • Functional operations. i.e. trig functions, logarithms and exponentials, etc...
  • Core NumPy-equivalent functions like sum(), mean(), diff(), max(), min()
  • File handling operations to read and write to files.

For a fully working implementation, see NumCpp or xtensor.

*Note: It is mostly complete as not all core features are implemented to their fullest extent.

Examples

This library aims to mimic NumPy functionality, so for example, if you want to run this in NumPy:

import numpy as np

x = np.array([1,2,3,4])
np.sum(x)

Try this in NumXX:

#include "NumXX.hpp"
namespace nx = numxx;

int main() {
    auto x = nx::NArray({1,2,3,4});
    nx::sum(x);
}

If it doesn't exist, it hasn't been implemented yet, and if you're feeling generous perhaps you can implement it yourself and open a pull request.

To see a small taster snippet of code, see this examples file.

More Documentation

This is only a README to help you get started quickly. For a more comprehensive documentation, please see the link below:
https://abdallahsoliman00.github.io/NumXX-Docs/

Contribution

This repository is open to contributions. If anyone wishes to contribute, please feel free to open a pull request.

Disclaimer

This library was a one-man project. The reliability of this library is therefore not guaranteed. Please use with caution.


Inspired by NumPy.

About

A NumPy implementation in C++.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors