Jiahao Chen Fix sentence fragment found by @tkelman  over 8 years ago

Commit id: 25a0dda7ba1ac03a4153e5b9bf941fccdd6670b5

deletions | additions      

       

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. 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}