Difference between revisions of "User:Tellenbach/3.4"

From Eigen
Jump to: navigation, search
(Created page with "=== Changes that might impact existing code === * Using float or double for indexing matrices, vectors and array will now fail to compile, ex.: <source lang="cpp"> MatrixXd A...")
 
Line 38: Line 38:
 
Vector4<MyType> V;  // Instead of Vector<4, MyType>
 
Vector4<MyType> V;  // Instead of Vector<4, MyType>
 
</source>
 
</source>
 
  
 
=== New Backends ===
 
=== New Backends ===
  
 
* '''Arm SVE:''' Eigen now supports Arm's [https://developer.arm.com/documentation/101726/0300/Learn-about-the-Scalable-Vector-Extension--SVE-/What-is-the-Scalable-Vector-Extension-  Scalable Vector Extension (SVE)]. Currently only fixed-lenght SVE vectors for <code>uint32_t</code> and <code>float</code> are available.
 
* '''Arm SVE:''' Eigen now supports Arm's [https://developer.arm.com/documentation/101726/0300/Learn-about-the-Scalable-Vector-Extension--SVE-/What-is-the-Scalable-Vector-Extension-  Scalable Vector Extension (SVE)]. Currently only fixed-lenght SVE vectors for <code>uint32_t</code> and <code>float</code> are available.
 +
 +
=== Improvements to Eigen Core ===
 +
 +
* Eigen now uses c++11 '''alignas''' keyword for static alignment. Users targeting C++17 only and recent compilers (e.g., GCC>=7, clang>=5, MSVC>=19.12) will thus be able to completely forget about all [http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html issues] related to static alignment, including <code>EIGEN_MAKE_ALIGNED_OPERATOR_NEW</code>.
 +
* Various performance improvements for products and Eigen's GEBP and GEMV kernels have been implemented:
 +
** By using half- and quater-packets the performance of matrix multiplications of small to medium sized matrices has been improved
 +
** Eigen's GEMM now falls back to GEMV if it detects that a matrix is a run-time vector
 +
** The performance of matrix products using Arm Neon has been drastically improved (up to 20%)

Revision as of 21:30, 17 August 2021

Changes that might impact existing code

  • Using float or double for indexing matrices, vectors and array will now fail to compile, ex.:
MatrixXd A(10,10);
float one = 1;
double a11 = A(one,1.); // compilation error here

New Major Features in Core

  • Add c++11 initializer_list constructors to Matrix and Array [doc]:
MatrixXi a {      // construct a 2x3 matrix
      {1,2,3},    // first row
      {4,5,6}     // second row
};
VectorXd v{{1, 2, 3, 4, 5}}; // construct a dynamic-size vector with 5 elements
Array<int,1,5> a{1,2, 3, 4, 5}; // initialize a fixed-size 1D array of size 5.
  • Add STL-compatible iterators for dense expressions [doc]. Some examples:
VectorXd v = ...;
MatrixXd A = ...;
// range for loop over all entries of v then A
for(auto x : v) { cout << x << " "; }
for(auto x : A.reshaped()) { cout << x << " "; }
// sort v then each column of A
std::sort(v.begin(), v.end());
for(auto c : A.colwise())
    std::sort(c.begin(), c.end());
  • Add C++11 template aliases for Matrix, Vector, and Array of common sizes, including generic Vector<Type,Size> and RowVector<Type,Size> aliases [doc].
MatrixX<double> M;  // Instead of MatrixXd or Matrix<Dynamic, Dynamic, double>
Vector4<MyType> V;   // Instead of Vector<4, MyType>

New Backends

Improvements to Eigen Core

  • Eigen now uses c++11 alignas keyword for static alignment. Users targeting C++17 only and recent compilers (e.g., GCC>=7, clang>=5, MSVC>=19.12) will thus be able to completely forget about all issues related to static alignment, including EIGEN_MAKE_ALIGNED_OPERATOR_NEW.
  • Various performance improvements for products and Eigen's GEBP and GEMV kernels have been implemented:
    • By using half- and quater-packets the performance of matrix multiplications of small to medium sized matrices has been improved
    • Eigen's GEMM now falls back to GEMV if it detects that a matrix is a run-time vector
    • The performance of matrix products using Arm Neon has been drastically improved (up to 20%)