https://github.com/polusai/sos-xeus-cling
SoS extension for C++
https://github.com/polusai/sos-xeus-cling
cpp14 jupyter-notebook sos
Last synced: about 1 year ago
JSON representation
SoS extension for C++
- Host: GitHub
- URL: https://github.com/polusai/sos-xeus-cling
- Owner: PolusAI
- License: mit
- Created: 2019-01-25T16:10:42.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-01-29T21:53:37.000Z (over 6 years ago)
- Last Synced: 2024-04-14T02:55:36.979Z (about 2 years ago)
- Topics: cpp14, jupyter-notebook, sos
- Language: Python
- Homepage:
- Size: 35.2 KB
- Stars: 9
- Watchers: 12
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
[](https://travis-ci.com/LabShare/sos-xeus-cling)
[](https://badge.fury.io/py/sos-xeus-cling)
# sos-xeus-cling
## SoS extension for C++. Developed independently from original SoS team. Please refer to [SoS Homepage](http://vatlab.github.io/SoS/) for details.
This language extension to SoS allows to use C++ with xeus-cling Jupyter kernel (https://github.com/QuantStack/xeus-cling) and exchange variables with other languages in Polyglot environment
### Dependencies
* gcc
`apt-get update; apt-get install gcc`
* xeus-cling
`conda install xeus-cling xwidgets notebook xtensor xtl xframe -c conda-forge/label/gcc7`
* sos-notebook `pip install sos-notebook --upgrade; python -m sos_notebook.install`
### Install
`pip install sos-xeus-cling`
### Supported variable types for transfer
#### From SoS to C++ (`%get` magic):
Scalar types
| Source: SoS (Python) type | Destination: C++ type |
|---------------------------------------------------------------------------------|----------------------------------------|
| `int` `long int` `np.intc` `np.intp` `np.int8` `np.int16` `np.int32` `np.int64` | `int` `long int` (depending on value) |
| `float` `np.float16` `np.float32` `np.float64` | `float` `double` (depending on value) |
| `np.longdouble` | `long double` |
| `str` | `std::string` |
| `bool` | `bool` |
Non-scalar types
| Source: SoS (Python) type | Destination: C++ type |
|-------------------------------------------------------|--------------------------------|
| `dict` (only homogeneous keys and values) | `std::map` |
| Sequence (`list`, `tuple`; only homogeneous elements) | `std::vector` |
| `numpy.ndarray` | [Xtensor](https://github.com/QuantStack/xtensor) `xt::xarray` |
| `pandas.DataFrame` | [Xframe](https://github.com/QuantStack/xframe) |
| | |
#### From C++ to SoS (`%put` magic):
Scalar types
| Source: C++ type | Destination: SoS (Python) type |
|----------------------------------------------|--------------------------------|
| `int` `short int` `long int` `long long int` | `int` |
| `float` `double` | `float` |
| `long double` | `np.longdouble` |
| `char` | `str` |
| `bool` | `bool` |
Non-scalar types
| Source: C++ type | Destination: SoS (Python) type |
|------------------|--------------------------------|
| `std::map` | `dict` |
| `std::vector` | `numpy.ndarray` |
| Xtensor | `numpy.ndarray` |
| Xframe | `pandas.DataFrame` |