Skip to content

Commit e289703

Browse files
authored
Merge pull request #261 from jcarpent/devel
Remove useless setup
2 parents d6a63ea + 9c63175 commit e289703

File tree

7 files changed

+45
-25
lines changed

7 files changed

+45
-25
lines changed

.github/workflows/windows-conda.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ jobs:
4747
:: Build and Install
4848
cmake --build . --config Release --target install
4949
50+
:: Build stubs
51+
git clone https://github.com/jcarpent/pybind11-stubgen.git
52+
python "%CD%\pybind11-stubgen\pybind11_stubgen\__init__.py" -o %CONDA_PREFIX%\Lib\site-packages\eigenpy eigenpy --boost-python --ignore-invalid signature --no-setup-py --root-module-suffix ""
53+
5054
:: Testing
5155
ctest --output-on-failure -C Release -V
5256

CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ FIND_NUMPY()
6262

6363
IF(WIN32)
6464
LINK_DIRECTORIES(${PYTHON_LIBRARY_DIRS})
65-
# Set default Windows build paths
66-
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY
67-
${PROJECT_BINARY_DIR}/Bin
68-
CACHE PATH "Single directory for all libraries")
69-
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY
70-
${PROJECT_BINARY_DIR}/Bin
71-
CACHE PATH "Single directory for all executables")
72-
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
73-
${PROJECT_BINARY_DIR}/Bin
74-
CACHE PATH "Sing$le directory for all archives")
65+
# # Set default Windows build paths
66+
# SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY
67+
# ${PROJECT_BINARY_DIR}/Bin
68+
# CACHE PATH "Single directory for all libraries")
69+
# SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY
70+
# ${PROJECT_BINARY_DIR}/Bin
71+
# CACHE PATH "Single directory for all executables")
72+
# SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
73+
# ${PROJECT_BINARY_DIR}/Bin
74+
# CACHE PATH "Sing$le directory for all archives")
7575
ENDIF(WIN32)
7676

7777
# ----------------------------------------------------

include/eigenpy/numpy.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ namespace eigenpy
4444
template <> struct NumpyEquivalentType<bool> { enum { type_code = NPY_BOOL };};
4545
template <> struct NumpyEquivalentType<int> { enum { type_code = NPY_INT };};
4646
template <> struct NumpyEquivalentType<unsigned int> { enum { type_code = NPY_UINT };};
47-
#if __APPLE__
48-
template <> struct NumpyEquivalentType<long> { enum { type_code = NPY_INT64 };};
49-
#endif
47+
template <> struct NumpyEquivalentType<long> { enum { type_code = NPY_LONG };};
48+
//#if defined _WIN32 || defined __CYGWIN__
49+
template <> struct NumpyEquivalentType<long long> { enum { type_code = NPY_LONGLONG };};
50+
//#else
51+
// template <> struct NumpyEquivalentType<long long> { enum { type_code = NPY_LONGLONG };};
52+
//#endif
5053
template <> struct NumpyEquivalentType<unsigned long> { enum { type_code = NPY_ULONG };};
51-
template <> struct NumpyEquivalentType<int64_t> { enum { type_code = NPY_INT64 };};
52-
// template <> struct NumpyEquivalentType<long long> { enum { type_code = NPY_LONGLONG };};
5354

5455
template<typename Scalar>
5556
bool isNumpyNativeType()

include/eigenpy/user-type.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "eigenpy/numpy-type.hpp"
1010
#include "eigenpy/register.hpp"
1111

12+
#include <iostream>
13+
1214
namespace eigenpy
1315
{
1416
/// \brief Default cast algo to cast a From to To. Can be specialized for any types.
@@ -256,6 +258,11 @@ namespace eigenpy
256258
assert(to_typenum >= 0 && "to_typenum is not valid");
257259
assert(from_array_descr != NULL && "from_array_descr is not valid");
258260

261+
std::cout << "From: " << bp::type_info(typeid(From)).name() << " " << Register::getTypeCode<From>()
262+
<< " to: " << bp::type_info(typeid(To)).name() << " " << Register::getTypeCode<To>()
263+
<< "\n to_typenum: " << to_typenum
264+
<< std::endl;
265+
259266
if(call_PyArray_RegisterCastFunc(from_array_descr,
260267
to_typenum,
261268
static_cast<PyArray_VectorUnaryFunc *>(&eigenpy::internal::cast<From,To>)) < 0)

unittest/python/test_MINRES.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@
1111
X = np.random.rand(dim,20)
1212
B = A.dot(X)
1313
X_est = minres.solve(B)
14+
print("A.dot(X_est):",A.dot(X_est))
15+
print("B:",B)
1416
assert eigenpy.is_approx(A.dot(X_est),B,1e-6)

unittest/python/test_user_type.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66
cols = 20
77

88
def test(dtype):
9-
mat = np.ones((rows,cols),dtype=dtype)
9+
mat = np.array(np.ones((rows,cols)).astype(np.intc),dtype=dtype)
1010
mat = np.random.rand(rows,cols).astype(dtype)
1111
mat_copy = mat.copy()
1212
assert (mat == mat_copy).all()
1313
assert not (mat != mat_copy).all()
1414

15-
# if version.parse(np.__version__) >= version.parse("1.21.0"): # check if it fixes for new versio of NumPy
15+
# if version.parse(np.__version__) >= version.parse("1.21.0"): # check if it fixes for new versio of NumPy
1616
# mat.fill(mat.dtype.type(20.))
1717
# mat_copy = mat.copy()
1818
# assert((mat == mat_copy).all())
1919
# assert(not (mat != mat_copy).all())
2020

2121
mat_op = mat + mat
2222
mat_op = mat.copy(order='F') + mat.copy(order='C')
23-
23+
2424
mat_op = mat - mat
2525
mat_op = mat * mat
2626
mat_op = mat.dot(mat.T)
@@ -45,7 +45,7 @@ def test_cast(from_dtype,to_dtype):
4545

4646
from_mat = np.zeros((rows,cols),dtype=from_dtype)
4747
to_mat = from_mat.astype(dtype=to_dtype)
48-
48+
4949
test(user_type.CustomDouble)
5050

5151
test_cast(user_type.CustomDouble,np.double)

unittest/user_type.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,20 @@ BOOST_PYTHON_MODULE(user_type)
196196

197197
eigenpy::registerCast<DoubleType,double>(true);
198198
eigenpy::registerCast<double,DoubleType>(true);
199-
eigenpy::registerCast<DoubleType,int32_t>(false);
200-
eigenpy::registerCast<int32_t,DoubleType>(true);
201-
eigenpy::registerCast<DoubleType,int64_t>(false);
202-
eigenpy::registerCast<int64_t,DoubleType>(true);
199+
eigenpy::registerCast<DoubleType,int>(false);
200+
eigenpy::registerCast<int,DoubleType>(true);
201+
eigenpy::registerCast<DoubleType,long long>(false);
202+
eigenpy::registerCast<long long,DoubleType>(true);
203+
eigenpy::registerCast<DoubleType,long>(false);
204+
eigenpy::registerCast<long,DoubleType>(true);
203205
eigenpy::registerCast<FloatType,double>(true);
204206
eigenpy::registerCast<double,FloatType>(false);
205-
eigenpy::registerCast<FloatType,int64_t>(false);
206-
eigenpy::registerCast<int64_t,FloatType>(true);
207+
eigenpy::registerCast<FloatType,long long>(false);
208+
eigenpy::registerCast<long long,FloatType>(true);
209+
eigenpy::registerCast<FloatType,int>(false);
210+
eigenpy::registerCast<int,FloatType>(true);
211+
eigenpy::registerCast<FloatType,long>(false);
212+
eigenpy::registerCast<long,FloatType>(true);
207213

208214
bp::implicitly_convertible<double,DoubleType>();
209215
bp::implicitly_convertible<DoubleType,double>();

0 commit comments

Comments
 (0)