Skip to content
Snippets Groups Projects
Unverified Commit e2897034 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #261 from jcarpent/devel

Remove useless setup
parents d6a63eab 9c631752
No related branches found
No related tags found
No related merge requests found
Pipeline #15945 passed with warnings
...@@ -47,6 +47,10 @@ jobs: ...@@ -47,6 +47,10 @@ jobs:
:: Build and Install :: Build and Install
cmake --build . --config Release --target install cmake --build . --config Release --target install
:: Build stubs
git clone https://github.com/jcarpent/pybind11-stubgen.git
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 ""
:: Testing :: Testing
ctest --output-on-failure -C Release -V ctest --output-on-failure -C Release -V
......
...@@ -62,16 +62,16 @@ FIND_NUMPY() ...@@ -62,16 +62,16 @@ FIND_NUMPY()
IF(WIN32) IF(WIN32)
LINK_DIRECTORIES(${PYTHON_LIBRARY_DIRS}) LINK_DIRECTORIES(${PYTHON_LIBRARY_DIRS})
# Set default Windows build paths # # Set default Windows build paths
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY # SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/Bin # ${PROJECT_BINARY_DIR}/Bin
CACHE PATH "Single directory for all libraries") # CACHE PATH "Single directory for all libraries")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY # SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/Bin # ${PROJECT_BINARY_DIR}/Bin
CACHE PATH "Single directory for all executables") # CACHE PATH "Single directory for all executables")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY # SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/Bin # ${PROJECT_BINARY_DIR}/Bin
CACHE PATH "Sing$le directory for all archives") # CACHE PATH "Sing$le directory for all archives")
ENDIF(WIN32) ENDIF(WIN32)
# ---------------------------------------------------- # ----------------------------------------------------
......
...@@ -44,12 +44,13 @@ namespace eigenpy ...@@ -44,12 +44,13 @@ namespace eigenpy
template <> struct NumpyEquivalentType<bool> { enum { type_code = NPY_BOOL };}; template <> struct NumpyEquivalentType<bool> { enum { type_code = NPY_BOOL };};
template <> struct NumpyEquivalentType<int> { enum { type_code = NPY_INT };}; template <> struct NumpyEquivalentType<int> { enum { type_code = NPY_INT };};
template <> struct NumpyEquivalentType<unsigned int> { enum { type_code = NPY_UINT };}; template <> struct NumpyEquivalentType<unsigned int> { enum { type_code = NPY_UINT };};
#if __APPLE__ template <> struct NumpyEquivalentType<long> { enum { type_code = NPY_LONG };};
template <> struct NumpyEquivalentType<long> { enum { type_code = NPY_INT64 };}; //#if defined _WIN32 || defined __CYGWIN__
#endif template <> struct NumpyEquivalentType<long long> { enum { type_code = NPY_LONGLONG };};
//#else
// template <> struct NumpyEquivalentType<long long> { enum { type_code = NPY_LONGLONG };};
//#endif
template <> struct NumpyEquivalentType<unsigned long> { enum { type_code = NPY_ULONG };}; template <> struct NumpyEquivalentType<unsigned long> { enum { type_code = NPY_ULONG };};
template <> struct NumpyEquivalentType<int64_t> { enum { type_code = NPY_INT64 };};
// template <> struct NumpyEquivalentType<long long> { enum { type_code = NPY_LONGLONG };};
template<typename Scalar> template<typename Scalar>
bool isNumpyNativeType() bool isNumpyNativeType()
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "eigenpy/numpy-type.hpp" #include "eigenpy/numpy-type.hpp"
#include "eigenpy/register.hpp" #include "eigenpy/register.hpp"
#include <iostream>
namespace eigenpy namespace eigenpy
{ {
/// \brief Default cast algo to cast a From to To. Can be specialized for any types. /// \brief Default cast algo to cast a From to To. Can be specialized for any types.
...@@ -256,6 +258,11 @@ namespace eigenpy ...@@ -256,6 +258,11 @@ namespace eigenpy
assert(to_typenum >= 0 && "to_typenum is not valid"); assert(to_typenum >= 0 && "to_typenum is not valid");
assert(from_array_descr != NULL && "from_array_descr is not valid"); assert(from_array_descr != NULL && "from_array_descr is not valid");
std::cout << "From: " << bp::type_info(typeid(From)).name() << " " << Register::getTypeCode<From>()
<< " to: " << bp::type_info(typeid(To)).name() << " " << Register::getTypeCode<To>()
<< "\n to_typenum: " << to_typenum
<< std::endl;
if(call_PyArray_RegisterCastFunc(from_array_descr, if(call_PyArray_RegisterCastFunc(from_array_descr,
to_typenum, to_typenum,
static_cast<PyArray_VectorUnaryFunc *>(&eigenpy::internal::cast<From,To>)) < 0) static_cast<PyArray_VectorUnaryFunc *>(&eigenpy::internal::cast<From,To>)) < 0)
......
...@@ -11,4 +11,6 @@ minres = eigenpy.MINRES(A) ...@@ -11,4 +11,6 @@ minres = eigenpy.MINRES(A)
X = np.random.rand(dim,20) X = np.random.rand(dim,20)
B = A.dot(X) B = A.dot(X)
X_est = minres.solve(B) X_est = minres.solve(B)
print("A.dot(X_est):",A.dot(X_est))
print("B:",B)
assert eigenpy.is_approx(A.dot(X_est),B,1e-6) assert eigenpy.is_approx(A.dot(X_est),B,1e-6)
...@@ -6,13 +6,13 @@ rows = 10 ...@@ -6,13 +6,13 @@ rows = 10
cols = 20 cols = 20
def test(dtype): def test(dtype):
mat = np.ones((rows,cols),dtype=dtype) mat = np.array(np.ones((rows,cols)).astype(np.intc),dtype=dtype)
mat = np.random.rand(rows,cols).astype(dtype) mat = np.random.rand(rows,cols).astype(dtype)
mat_copy = mat.copy() mat_copy = mat.copy()
assert (mat == mat_copy).all() assert (mat == mat_copy).all()
assert not (mat != mat_copy).all() assert not (mat != mat_copy).all()
# if version.parse(np.__version__) >= version.parse("1.21.0"): # check if it fixes for new versio of NumPy # if version.parse(np.__version__) >= version.parse("1.21.0"): # check if it fixes for new versio of NumPy
# mat.fill(mat.dtype.type(20.)) # mat.fill(mat.dtype.type(20.))
# mat_copy = mat.copy() # mat_copy = mat.copy()
# assert((mat == mat_copy).all()) # assert((mat == mat_copy).all())
...@@ -20,7 +20,7 @@ def test(dtype): ...@@ -20,7 +20,7 @@ def test(dtype):
mat_op = mat + mat mat_op = mat + mat
mat_op = mat.copy(order='F') + mat.copy(order='C') mat_op = mat.copy(order='F') + mat.copy(order='C')
mat_op = mat - mat mat_op = mat - mat
mat_op = mat * mat mat_op = mat * mat
mat_op = mat.dot(mat.T) mat_op = mat.dot(mat.T)
...@@ -45,7 +45,7 @@ def test_cast(from_dtype,to_dtype): ...@@ -45,7 +45,7 @@ def test_cast(from_dtype,to_dtype):
from_mat = np.zeros((rows,cols),dtype=from_dtype) from_mat = np.zeros((rows,cols),dtype=from_dtype)
to_mat = from_mat.astype(dtype=to_dtype) to_mat = from_mat.astype(dtype=to_dtype)
test(user_type.CustomDouble) test(user_type.CustomDouble)
test_cast(user_type.CustomDouble,np.double) test_cast(user_type.CustomDouble,np.double)
......
...@@ -196,14 +196,20 @@ BOOST_PYTHON_MODULE(user_type) ...@@ -196,14 +196,20 @@ BOOST_PYTHON_MODULE(user_type)
eigenpy::registerCast<DoubleType,double>(true); eigenpy::registerCast<DoubleType,double>(true);
eigenpy::registerCast<double,DoubleType>(true); eigenpy::registerCast<double,DoubleType>(true);
eigenpy::registerCast<DoubleType,int32_t>(false); eigenpy::registerCast<DoubleType,int>(false);
eigenpy::registerCast<int32_t,DoubleType>(true); eigenpy::registerCast<int,DoubleType>(true);
eigenpy::registerCast<DoubleType,int64_t>(false); eigenpy::registerCast<DoubleType,long long>(false);
eigenpy::registerCast<int64_t,DoubleType>(true); eigenpy::registerCast<long long,DoubleType>(true);
eigenpy::registerCast<DoubleType,long>(false);
eigenpy::registerCast<long,DoubleType>(true);
eigenpy::registerCast<FloatType,double>(true); eigenpy::registerCast<FloatType,double>(true);
eigenpy::registerCast<double,FloatType>(false); eigenpy::registerCast<double,FloatType>(false);
eigenpy::registerCast<FloatType,int64_t>(false); eigenpy::registerCast<FloatType,long long>(false);
eigenpy::registerCast<int64_t,FloatType>(true); eigenpy::registerCast<long long,FloatType>(true);
eigenpy::registerCast<FloatType,int>(false);
eigenpy::registerCast<int,FloatType>(true);
eigenpy::registerCast<FloatType,long>(false);
eigenpy::registerCast<long,FloatType>(true);
bp::implicitly_convertible<double,DoubleType>(); bp::implicitly_convertible<double,DoubleType>();
bp::implicitly_convertible<DoubleType,double>(); bp::implicitly_convertible<DoubleType,double>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment