diff --git a/cython/build.sh b/cython/build.sh new file mode 100755 index 000000000..d938f120d --- /dev/null +++ b/cython/build.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# exit if any command returns non-zero +set -e +# print out each command for debugging +set -x + +#usage: wrap [--matlab|--cython] absoluteInterfacePath moduleName toolboxPath headerPath +wrap --cython $PWD gtsam $PWD ../ + +python setup.py build_ext --inplace diff --git a/cython/install.sh b/cython/install.sh new file mode 100755 index 000000000..987a25d06 --- /dev/null +++ b/cython/install.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +virtualenv venv +source venv/bin/activate +pip install -r requirements.txt +pip install eigency \ No newline at end of file diff --git a/cython/requirements.txt b/cython/requirements.txt index 39a5f4d1d..13c89b7e3 100644 --- a/cython/requirements.txt +++ b/cython/requirements.txt @@ -1,3 +1,2 @@ -numpy>=1.11.1 -eigency>=1.66 -Cython>=0.24.1 \ No newline at end of file +Cython==0.24.1 +numpy==1.11.1 diff --git a/cython/setup.py b/cython/setup.py index 340e1cc66..009f62c5c 100644 --- a/cython/setup.py +++ b/cython/setup.py @@ -3,6 +3,8 @@ from distutils.extension import Extension from Cython.Build import cythonize import eigency + + setup( ext_modules = cythonize(Extension( "gtsam", @@ -13,5 +15,6 @@ setup( libraries = ['gtsam'], library_dirs = ["/Users/dta-huynh/install/lib"], - language="c++")), + language="c++", + extra_compile_args=["-std=c++11"])), ) \ No newline at end of file diff --git a/cython/test_gtsam.py b/cython/tests.py similarity index 83% rename from cython/test_gtsam.py rename to cython/tests.py index b4f600bdb..1df5b7f87 100644 --- a/cython/test_gtsam.py +++ b/cython/tests.py @@ -23,24 +23,25 @@ Rmat = np.array([ [0.104218, 0.990074, -0.0942928], [-0.0942928, 0.104218, 0.990074] ]) -r5 = Rot3.ctor(Rmat) +r5 = Rot3.ctor1(Rmat) r5._print(b"r5: ") l = Rot3.Logmap(r5) print("l = ", l) -noise = Gaussian.Covariance(Rmat) +noise = noiseModel_Gaussian.Covariance(Rmat) noise._print(b"noise:") D = np.array([1.,2.,3.]) -diag = Diagonal.Variances(D) +diag = noiseModel_Diagonal.Variances(D) print("diag:", diag) diag._print(b"diag:") print("diag R:", diag.R()) p = Point3() -factor = BetweenFactorPoint3(1,2,p, noise) +p._print("p:") +factor = BetweenFactorPoint3.ctor(1,2,p, noise) factor._print(b"factor:") vv = VectorValues() @@ -50,7 +51,7 @@ vv.insert(2, np.array([3.,4.])) vv.insert(3, np.array([5.,6.,7.,8.])) vv._print(b"vv:") -vv2 = VectorValues.ctor2(vv) +vv2 = VectorValues.ctor1(vv) vv2.insert(4, np.array([4.,2.,1])) vv2._print(b"vv2:") vv._print(b"vv:")