diff --git a/configure.ac b/configure.ac index d123176d2..b5a4f5258 100644 --- a/configure.ac +++ b/configure.ac @@ -54,6 +54,18 @@ AC_ARG_ENABLE([blas], AM_CONDITIONAL([USE_BLAS_MACOS], [test x$blas = xtrue && test x$ISMAC = xtrue]) AM_CONDITIONAL([USE_BLAS_LINUX], [test x$blas = xtrue && test x$ISMAC = xfalse]) +# enable LAPACK +AC_ARG_ENABLE([lapack], + [ --enable-lapack Enable external LAPACK library], + [case "${enableval}" in + yes) lapack=true ;; + no) lapack=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-lapack]) ;; + esac],[lapack=false]) + +AM_CONDITIONAL([USE_LAPACK_MACOS], [test x$lapack = xtrue && test x$ISMAC = xtrue]) +AM_CONDITIONAL([USE_VECLIB_MACOS], [(test x$lapack = xtrue || test x$blas = xtrue) && test x$ISMAC = xtrue]) + #enabgle SparseQR for linear solving AC_ARG_ENABLE([spqr], [ --enable-spqr Enable SparseQR library support], diff --git a/cpp/Makefile.am b/cpp/Makefile.am index b7f889373..c2383cf19 100644 --- a/cpp/Makefile.am +++ b/cpp/Makefile.am @@ -322,13 +322,20 @@ libgtsam_la_LDFLAGS += -lcblas -latlas # $(BLAS_LIBS) $(LIBS) $(FLIBS) endif if USE_BLAS_MACOS -AM_CXXFLAGS += -DGT_USE_CBLAS -DYA_BLAS -DYA_LAPACK -DYA_BLASMULT -I/System/Library/Frameworks/vecLib.framework/Headers +AM_CXXFLAGS += -DGT_USE_CBLAS +endif + +if USE_LAPACK_MACOS +AM_CXXFLAGS += -DGT_USE_LAPACK +endif + +if USE_VECLIB_MACOS +AM_CXXFLAGS += -DYA_BLAS -DYA_LAPACK -DYA_BLASMULT -I/System/Library/Frameworks/vecLib.framework/Headers libgtsam_la_CPPFLAGS += -DGT_USE_CBLAS -DYA_BLAS -DYA_LAPACK -DYA_BLASMULT -I/System/Library/Frameworks/vecLib.framework/Headers AM_LDFLAGS += -lcblas -latlas libgtsam_la_LDFLAGS += -framework vecLib -lcblas -latlas endif - TESTS = $(check_PROGRAMS) CXXLINK = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \ $(CXXLD) -g $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ diff --git a/cpp/Matrix.cpp b/cpp/Matrix.cpp index 319c1d0ab..0d0ca56e2 100644 --- a/cpp/Matrix.cpp +++ b/cpp/Matrix.cpp @@ -13,12 +13,15 @@ #ifdef GT_USE_CBLAS #ifdef YA_BLAS #include -#include #else #include #endif #endif +#ifdef GT_USE_LAPACK +#include +#endif + #include #include #include @@ -654,7 +657,7 @@ void householder(Matrix &A, size_t k) { /* ************************************************************************* */ /** in-place householder */ /* ************************************************************************* */ -#ifdef GT_USE_CBLAS +#ifdef GT_USE_LAPACK void householder(Matrix &A) { int m = A.size1(); int n = A.size2(); diff --git a/cpp/Matrix.h b/cpp/Matrix.h index b1ab8ea82..c4ca340e1 100644 --- a/cpp/Matrix.h +++ b/cpp/Matrix.h @@ -255,7 +255,7 @@ void householder(Matrix& A, size_t k); * @param k number of columns to zero out below diagonal * @return nothing: in place !!! */ -#ifdef GT_USE_CBLAS +#ifdef GT_USE_LAPACK void householder(Matrix &A); #endif diff --git a/cpp/NoiseModel.cpp b/cpp/NoiseModel.cpp index 67e63f63c..46cdd17d3 100644 --- a/cpp/NoiseModel.cpp +++ b/cpp/NoiseModel.cpp @@ -118,7 +118,7 @@ SharedDiagonal Gaussian::QR(Matrix& Ab) const { if (verbose) gtsam::print(Ab, "Ab after whitening"); // Perform in-place Householder -#ifdef GT_USE_CBLAS +#ifdef GT_USE_LAPACK householder(Ab); #else householder(Ab, maxRank); diff --git a/cpp/testMatrix.cpp b/cpp/testMatrix.cpp index 3d59ee6ba..fce3d0bf2 100644 --- a/cpp/testMatrix.cpp +++ b/cpp/testMatrix.cpp @@ -641,7 +641,7 @@ TEST( matrix, houseHolder ) /* ************************************************************************* */ // unit tests for housholder transformation /* ************************************************************************* */ -#ifdef GT_USE_CBLAS +#ifdef GT_USE_LAPACK TEST( matrix, houseHolder2 ) { double data[] = { -5, 0, 5, 0, 0, 0, -1,