diff --git a/cpp/Makefile.am b/cpp/Makefile.am index b769ad7c3..7c956ca76 100644 --- a/cpp/Makefile.am +++ b/cpp/Makefile.am @@ -302,8 +302,8 @@ libgtsam_la_LDFLAGS += $(BLAS_LIBS) $(LIBS) $(FLIBS) # -lcblas -latlas endif if USE_BLAS_MACOS -AM_CXXFLAGS += -DCBLAS -DYA_BLAS -DYA_LAPACK -DYA_BLASMULT -I/System/Library/Frameworks/vecLib.framework/Headers -libgtsam_la_CPPFLAGS += -DCBLAS -DYA_BLAS -DYA_LAPACK -DYA_BLASMULT -I/System/Library/Frameworks/vecLib.framework/Headers +AM_CXXFLAGS += -DYA_BLAS -DYA_LAPACK -DYA_BLASMULT -I/System/Library/Frameworks/vecLib.framework/Headers +libgtsam_la_CPPFLAGS += -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 diff --git a/cpp/Matrix.cpp b/cpp/Matrix.cpp index ee02acc20..73c583186 100644 --- a/cpp/Matrix.cpp +++ b/cpp/Matrix.cpp @@ -15,6 +15,10 @@ #include #endif +#ifdef YA_BLAS +#include +#endif + #ifdef GSL #include // needed for gsl blas #include @@ -153,10 +157,10 @@ bool assert_equal(const std::list& As, const std::list& Bs, doub /* ************************************************************************* */ void multiplyAdd(double alpha, const Matrix& A, const Vector& x, Vector& e) { -#if defined CBLAS +#if defined (CBLAS) || defined (YA_BLAS) // uncomment and run tests to verify blas is enabled -// throw runtime_error("You are in multiplyAdd!"); +// throw runtime_error("You are in multiplyAdd / cblas!"); // get sizes const size_t m = A.size1(), n = A.size2(); @@ -174,11 +178,13 @@ void multiplyAdd(double alpha, const Matrix& A, const Vector& x, Vector& e) { cblas_dgemv(CblasRowMajor, CblasNoTrans, m, n, alpha, Aptr, ida, Xptr, incx, beta, Eptr, incy); #elif defined GSL +// throw runtime_error("You are in multiplyAdd / gsl!"); gsl_vector_const_view xg = gsl_vector_const_view_array(x.data().begin(), x.size()); gsl_vector_view eg = gsl_vector_view_array(e.data().begin(), e.size()); gsl_matrix_const_view Ag = gsl_matrix_const_view_array(A.data().begin(), A.size1(), A.size2()); gsl_blas_dgemv (CblasNoTrans, alpha, &(Ag.matrix), &(xg.vector), 1.0, &(eg.vector)); #else +// throw runtime_error("You are in multiplyAdd / unoptimized!"); // ublas e += prod(A,x) is terribly slow size_t m = A.size1(), n = A.size2(); double * ei = e.data().begin();