Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/macos-linux-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI - EigenPy for Mac OS X/Linux via Conda

on: [push,pull_request]

jobs:
eigenpy-conda:
name: CI - EigenPy on ${{ matrix.os }} via Conda
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest"]

steps:
- uses: actions/checkout@v2

- name: Checkout submodules
run: |
git submodule update --init
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: eigenpy
auto-update-conda: true
environment-file: .github/workflows/conda/environment.yml
python-version: 3.8

- name: Install cmake and update conda
shell: bash -l {0}
run: |
conda activate eigenpy
conda install cmake -c main
- name: Build EigenPy
shell: bash -l {0}
run: |
conda activate eigenpy
echo $CONDA_PREFIX
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=$(which python3)
make
make build_tests
export CTEST_OUTPUT_ON_FAILURE=1
make test
make install
- name: Uninstall EigenPy
shell: bash -l {0}
run: |
cd build
make uninstall
2 changes: 1 addition & 1 deletion cmake
12 changes: 9 additions & 3 deletions include/eigenpy/numpy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@

#if defined _WIN32 || defined __CYGWIN__
#define EIGENPY_GET_PY_ARRAY_TYPE(array) \
call_PyArray_ObjectType(reinterpret_cast<PyObject *>(array), 0)
call_PyArray_MinScalarType(array)->type_num
#else
#define EIGENPY_GET_PY_ARRAY_TYPE(array) \
PyArray_ObjectType(reinterpret_cast<PyObject *>(array), 0)
PyArray_MinScalarType(array)->type_num
#endif

namespace eigenpy
Expand All @@ -51,6 +51,10 @@ namespace eigenpy
EIGENPY_DLLAPI void call_PyArray_InitArrFuncs(PyArray_ArrFuncs * funcs);

EIGENPY_DLLAPI int call_PyArray_RegisterDataType(PyArray_Descr * dtype);

EIGENPY_DLLAPI int call_PyArray_RegisterCanCast(PyArray_Descr *descr, int totype, NPY_SCALARKIND scalar);

EIGENPY_DLLAPI PyArray_Descr * call_PyArray_MinScalarType(PyArrayObject *arr);
}
#else
#define call_PyArray_Check(py_obj) PyArray_Check(py_obj)
Expand All @@ -59,8 +63,10 @@ namespace eigenpy
PyArray_New(py_type_ptr,nd,shape,np_type,NULL,data_ptr,0,options,NULL)
#define getPyArrayType() &PyArray_Type
#define call_PyArray_DescrFromType(typenum) PyArray_DescrFromType(typenum)
#define call_PyArray_MinScalarType(py_arr) PyArray_MinScalarType(py_arr)
#define call_PyArray_InitArrFuncs(funcs) PyArray_InitArrFuncs(funcs)
#define call_PyArray_RegisterDataType(dtype) PyArray_RegisterDataType(dtype)
#define call_PyArray_RegisterDataType(dtype) PyArray_RegisterDataType(dtype)
#define call_PyArray_RegisterCanCast(descr,totype,scalar) PyArray_RegisterCanCast(descr,totype,scalar)
#endif

#endif // ifndef __eigenpy_numpy_hpp__
3 changes: 3 additions & 0 deletions include/eigenpy/user-type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ namespace eigenpy
copyswap, copyswapn,
dotfunc);

call_PyArray_RegisterCanCast(call_PyArray_DescrFromType(NPY_OBJECT),
code, NPY_NOSCALAR);

return code;
}

Expand Down
10 changes: 10 additions & 0 deletions src/numpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ namespace eigenpy
{
return PyArray_RegisterDataType(dtype);
}

PyArray_Descr * call_PyArray_MinScalarType(PyArrayObject * arr)
{
return PyArray_MinScalarType(arr);
}

int call_PyArray_RegisterCanCast(PyArray_Descr *descr, int totype, NPY_SCALARKIND scalar)
{
return PyArray_RegisterCanCast(descr,totype,scalar);
}

#endif
}