GithubHelp home page GithubHelp logo

yokaze / pyscience11 Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 5.0 38 KB

C++11 wrapper for NumPy, SciPy and Matplotlib using pybind11

License: MIT License

Python 2.58% Makefile 0.06% C++ 97.36%
python numpy scipy matplotlib pybind11

pyscience11's Introduction

Overview

pyscience11 is a C++11 wrapper for NumPy, SciPy and Matplotlib, that provides lightspeed access to their functionality.

#include <pybind11/embed.h>
#include <pybind11/pybind11.h>
#include <pyscience11/matplotlib.h>
#include <pyscience11/matplotlib/pyplot.h>
#include <pyscience11/numpy.h>
#include <pyscience11/scipy/special.h>

namespace py = pybind11;
namespace m11 = matplotlib11;
namespace n11 = numpy11;
namespace s11 = scipy11;

int main(void)
{
    py::scoped_interpreter interpreter;

    auto numpy = n11::import_numpy();
    auto scipy_special = s11::scipy::import_special();
    auto x = numpy.linspace(-2, 2, 1001, py::arg("dtype") = numpy.attr("float32"));
    auto y = scipy_special.erf(x);

    auto matplotlib = m11::import_matplotlib();
    matplotlib.use("TkAgg");

    auto pl = m11::matplotlib::import_pyplot();
    pl.plot(x, y);
    pl.show();

    return 0;
}

Install

This library is header-only, therefore nothing needs to be installed.

Following command could be helpful to place headers into system directory.

pip install pyscience11

Requirements

Contact

If you have any question about the library, feel free to contact me: https://github.com/yokaze

pyscience11's People

Contributors

galou avatar yokaze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pyscience11's Issues

How to use plt.imshow() for display cv::Mat images?

I was looking for an easy way to plot subplots of images in C++. But this was the best that I could find. I know that plt.imshow() is not used for subplts. I'd use plt.subplots. But first I'd like to figure out how to use plt.imshow() for displaying images in C++. How would I do this given that images in C++ are of type cv::Mat?

Thank you so much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.