Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
eigenpy
Commits
e2897034
Unverified
Commit
e2897034
authored
Sep 07, 2021
by
Justin Carpentier
Committed by
GitHub
Sep 07, 2021
Browse files
Merge pull request #261 from jcarpent/devel
Remove useless setup
parents
d6a63eab
9c631752
Pipeline
#15945
passed with stage
in 2 minutes and 37 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.github/workflows/windows-conda.yml
View file @
e2897034
...
...
@@ -47,6 +47,10 @@ jobs:
:: Build and 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
ctest --output-on-failure -C Release -V
...
...
CMakeLists.txt
View file @
e2897034
...
...
@@ -62,16 +62,16 @@ FIND_NUMPY()
IF
(
WIN32
)
LINK_DIRECTORIES
(
${
PYTHON_LIBRARY_DIRS
}
)
# Set default Windows build paths
SET
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY
${
PROJECT_BINARY_DIR
}
/Bin
CACHE PATH
"Single directory for all libraries"
)
SET
(
CMAKE_RUNTIME_OUTPUT_DIRECTORY
${
PROJECT_BINARY_DIR
}
/Bin
CACHE PATH
"Single directory for all executables"
)
SET
(
CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${
PROJECT_BINARY_DIR
}
/Bin
CACHE PATH
"Sing$le directory for all archives"
)
#
# Set default Windows build paths
#
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY
#
${PROJECT_BINARY_DIR}/Bin
#
CACHE PATH "Single directory for all libraries")
#
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY
#
${PROJECT_BINARY_DIR}/Bin
#
CACHE PATH "Single directory for all executables")
#
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
#
${PROJECT_BINARY_DIR}/Bin
#
CACHE PATH "Sing$le directory for all archives")
ENDIF
(
WIN32
)
# ----------------------------------------------------
...
...
include/eigenpy/numpy.hpp
View file @
e2897034
...
...
@@ -44,12 +44,13 @@ namespace eigenpy
template
<
>
struct
NumpyEquivalentType
<
bool
>
{
enum
{
type_code
=
NPY_BOOL
};};
template
<
>
struct
NumpyEquivalentType
<
int
>
{
enum
{
type_code
=
NPY_INT
};};
template
<
>
struct
NumpyEquivalentType
<
unsigned
int
>
{
enum
{
type_code
=
NPY_UINT
};};
#if __APPLE__
template
<
>
struct
NumpyEquivalentType
<
long
>
{
enum
{
type_code
=
NPY_INT64
};};
#endif
template
<
>
struct
NumpyEquivalentType
<
long
>
{
enum
{
type_code
=
NPY_LONG
};};
//#if defined _WIN32 || defined __CYGWIN__
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
<
int64_t
>
{
enum
{
type_code
=
NPY_INT64
};};
// template <> struct NumpyEquivalentType<long long> { enum { type_code = NPY_LONGLONG };};
template
<
typename
Scalar
>
bool
isNumpyNativeType
()
...
...
include/eigenpy/user-type.hpp
View file @
e2897034
...
...
@@ -9,6 +9,8 @@
#include "eigenpy/numpy-type.hpp"
#include "eigenpy/register.hpp"
#include <iostream>
namespace
eigenpy
{
/// \brief Default cast algo to cast a From to To. Can be specialized for any types.
...
...
@@ -256,6 +258,11 @@ namespace eigenpy
assert
(
to_typenum
>=
0
&&
"to_typenum 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
,
to_typenum
,
static_cast
<
PyArray_VectorUnaryFunc
*>
(
&
eigenpy
::
internal
::
cast
<
From
,
To
>
))
<
0
)
...
...
unittest/python/test_MINRES.py
View file @
e2897034
...
...
@@ -11,4 +11,6 @@ minres = eigenpy.MINRES(A)
X
=
np
.
random
.
rand
(
dim
,
20
)
B
=
A
.
dot
(
X
)
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
)
unittest/python/test_user_type.py
View file @
e2897034
...
...
@@ -6,13 +6,13 @@ rows = 10
cols
=
20
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_copy
=
mat
.
copy
()
assert
(
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_copy = mat.copy()
# assert((mat == mat_copy).all())
...
...
@@ -20,7 +20,7 @@ def test(dtype):
mat_op
=
mat
+
mat
mat_op
=
mat
.
copy
(
order
=
'F'
)
+
mat
.
copy
(
order
=
'C'
)
mat_op
=
mat
-
mat
mat_op
=
mat
*
mat
mat_op
=
mat
.
dot
(
mat
.
T
)
...
...
@@ -45,7 +45,7 @@ def test_cast(from_dtype,to_dtype):
from_mat
=
np
.
zeros
((
rows
,
cols
),
dtype
=
from_dtype
)
to_mat
=
from_mat
.
astype
(
dtype
=
to_dtype
)
test
(
user_type
.
CustomDouble
)
test_cast
(
user_type
.
CustomDouble
,
np
.
double
)
...
...
unittest/user_type.cpp
View file @
e2897034
...
...
@@ -196,14 +196,20 @@ BOOST_PYTHON_MODULE(user_type)
eigenpy
::
registerCast
<
DoubleType
,
double
>
(
true
);
eigenpy
::
registerCast
<
double
,
DoubleType
>
(
true
);
eigenpy
::
registerCast
<
DoubleType
,
int32_t
>
(
false
);
eigenpy
::
registerCast
<
int32_t
,
DoubleType
>
(
true
);
eigenpy
::
registerCast
<
DoubleType
,
int64_t
>
(
false
);
eigenpy
::
registerCast
<
int64_t
,
DoubleType
>
(
true
);
eigenpy
::
registerCast
<
DoubleType
,
int
>
(
false
);
eigenpy
::
registerCast
<
int
,
DoubleType
>
(
true
);
eigenpy
::
registerCast
<
DoubleType
,
long
long
>
(
false
);
eigenpy
::
registerCast
<
long
long
,
DoubleType
>
(
true
);
eigenpy
::
registerCast
<
DoubleType
,
long
>
(
false
);
eigenpy
::
registerCast
<
long
,
DoubleType
>
(
true
);
eigenpy
::
registerCast
<
FloatType
,
double
>
(
true
);
eigenpy
::
registerCast
<
double
,
FloatType
>
(
false
);
eigenpy
::
registerCast
<
FloatType
,
int64_t
>
(
false
);
eigenpy
::
registerCast
<
int64_t
,
FloatType
>
(
true
);
eigenpy
::
registerCast
<
FloatType
,
long
long
>
(
false
);
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
<
DoubleType
,
double
>
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment