Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamesetsmith/pybind11_numpy
A sandbox for me to practice passing NumPy arrays back and forth to C++ with pybind11.
https://github.com/jamesetsmith/pybind11_numpy
Last synced: 15 days ago
JSON representation
A sandbox for me to practice passing NumPy arrays back and forth to C++ with pybind11.
- Host: GitHub
- URL: https://github.com/jamesetsmith/pybind11_numpy
- Owner: jamesETsmith
- License: apache-2.0
- Created: 2021-10-11T16:45:10.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-06T01:33:52.000Z (5 months ago)
- Last Synced: 2024-08-05T11:12:52.003Z (3 months ago)
- Language: C++
- Size: 21.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Overview
![Build](https://github.com/jamesETsmith/pybind11_numpy/actions/workflows/cmake.yml/badge.svg) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/b63545b9023a466e961b4aeed9c12806)](https://www.codacy.com/gh/jamesETsmith/pybind11_numpy/dashboard?utm_source=github.com&utm_medium=referral&utm_content=jamesETsmith/pybind11_numpy&utm_campaign=Badge_Grade)This a set of simple examples for using `pybind11` with NumPy arrays focusing specifically on passing arrays from Python to C++, modifying them, and then using them some more in Python.
# Software Prerequisites
- CMake >= 3.19
- C++ compiler (`-std=c++11` or later)
- Python 3.X
- pytest
- pybind11 (included in this package)# Install and Test
```bash
git clone --recursive https://github.com/jamesETsmith/pybind11_numpy.git
cd pybind11_numpy
CXX=YOUR_C++_COMPILER cmake -B build
cmake --build build
PYTHONPATH=build/:$PYTHONPATH pytest -v test
```