diff --git a/Makefile b/Makefile index 49674a6..ee03ff6 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ SHELL := /bin/bash clean: ## Clean up rm -rf build dist *.egg-info - for name in fimdlp/cfimdlp.cpp fimdlp/fimdlp.cpython-310-darwin.so;do if [ -f $name ]; then rm $name; fi; done + if [ -f fimdlp/cfimdlp.cpp ]; then rm fimdlp/cfimdlp.cpp; fi; + if [ -f fimdlp/cppfimdlp.cpython-310-darwin.so ]; then rm fimdlp/cppfimdlp.cpython-310-darwin.so; fi; lint: ## Lint and static-check black fimdlp @@ -21,7 +22,9 @@ build: ## Build package buildext: ## Build extension rm -fr dist/* rm -fr build/* + make clean python setup.py build_ext + echo "Build extension success"; mv build/lib.macosx-12-x86_64-cpython-310/cppfimdlp.cpython-310-darwin.so fimdlp; audit: ## Audit pip pip-audit diff --git a/fimdlp/CPPFImdlp.cpp b/fimdlp/CPPFImdlp.cpp index 3600959..5f9039b 100644 --- a/fimdlp/CPPFImdlp.cpp +++ b/fimdlp/CPPFImdlp.cpp @@ -10,14 +10,18 @@ namespace CPPFImdlp std::vector CPPFImdlp::cutPoints(std::vector &X, std::vector &y) { std::vector cutPts; - int i, ant = X.at(0); + int i, ant = X.at(0), anty = y.at(0); int n = X.size(); for (i = 1; i < n; i++) { if (X.at(i) != ant) { - cutPts.push_back(float(X.at(i) + ant) / 2); - ant = X.at(i); + if (y.at(i) != anty) + { + cutPts.push_back(float(X.at(i) + ant) / 2); + ant = X.at(i); + anty = y.at(i); + } } } return cutPts; diff --git a/fimdlp/cppfimdlp.cpython-310-darwin.so b/fimdlp/cppfimdlp.cpython-310-darwin.so index c553ecc..4e5cb5b 100755 Binary files a/fimdlp/cppfimdlp.cpython-310-darwin.so and b/fimdlp/cppfimdlp.cpython-310-darwin.so differ