Jiahao Chen Fix Makefile to pay nice with Ubuntu compilers  over 8 years ago

Commit id: ae2d7694a0b6585a1549f1d32d526fdf6d864d26

deletions | additions      

       

DIR_EIGEN=/usr/local/Cellar/eigen/3.2.6 DIR_EIGEN=/usr  CXX=c++  CXXOPTS=-std=c++11 -Wall -Wno-unused-variable -Wno-deprecated-declarations  all: bin/eigen3  bin/eigen3  R -f R.R > /dev/null  bin/eigen3: eigen.cpp  $(CXX) $(CXXOPTS) -I $(DIR_EIGEN)/include/eigen3 -o eigen3 eigen.cpp         

\subsection{Eigen}  Eigen is a C++ library for high performance numerical linear algebra.\cite{eigenweb}\footnote{The version of Eigen tested was v3.2.6, compiled with clang with Apple LLVM v7.0.2. Eigen supports vectors and matrices of fixed sizes (known at compile time) and dynamic sizes (known only at run time). Here, we consigider consider  only the dynamic classes \verb|VectorXd| and \verb|MatrixXd|, as they classes, which  have the most intricate semantics.} semantics.  }  Eigen heavily exploits C++ expression templates to provide flexibility resulting from type polymorphism. Notably, it uses special templates (meant for internal use) to capture the result of intermediate expressions, performing what computer scientists call ``lazy evaluation''. For example, the result of the expression \verb|x.transpose()|, performing the transpose of a vector \verb|x| (of type \verb|VectorXd|) is neither a vector \verb|VectorXd| nor a matrix \verb|MatrixXd|, but rather a special type, \verb|Transpose<| \verb|VectorXd>|, that can be assigned to a new \verb|VectorXd| variable or a new \verb|MatrixXd| variable. Similar types are used to capture and build other intermediate expressions, such as \verb|ProductReturnType| for the matrix-vector product \verb|A*x|. This ingenious strategy of determining the output type only at assignment time is made possible in a static language like C++, where users are expected to specify the output type of a variable when declared.\footnote{Strictly speaking, C++ also allows for run-time polymorphism, where the output type is only determined at run time. However, the mechanisms for doing so are cumbersome and in most cases produce significant performance slowdowns.} The result is that in almost all cases, users can choose to imagine the result of most linear algebra expressions as vectors or matrices as they so choose. Nevertheless, Eigen's strategy is not perfect. The heavy use of internal classes to represent the output of computations means that both assignment and equality testing in Eigen must be overloaded with new definitions to meet user expectations. Oftentimes, the validity of an assignment statement can only be determined at run time, resulting in overhead due to run time checks for compatible shape and so on. Many new methods have to be introduced to overload C++'s assignment and equality testing operators. Furthermore, the assignment logic of vector transpose is ambiguous and may lead to subtle logic errors because the result of assignment may violate user expectations of the transitivity of equality. In Eigen, the result of \verb|x.transpose()| can be assigned to either a \verb|VectorXd| variable or \verb|MatrixXd| variable, i.e.\ , both of the following statements are valid: \begin{verbatim}