This forum has been archived. All content is frozen. Please use KDE Discuss instead.

A bit confused on fixed / dynamic sizing.

Tags: None
(comma "," separated)
michaelafanasiev
Registered Member
Posts
1
Karma
0
Hi guys,

Quick question. I'm writing a finite element code that works both in 2d and 3d, and using Eigen for matrix/vector multiplication.

For those who aren't familiar: an important part of the finite element algorithm includes calculating the jacobian of a coordinate transform. In practice, this involves multiplication of terms with a 2x2 (in 2 dimensions) or 3x3 (in 3 dimensions) matrix. I see that 2x2 matrices are fixed-sized vectorizable, while 3x3 matrices are not. Does this mean I will see better performance by using fixed-size matrices in the 2d code, and using dynamically generated matrices in the 3d code? As an added detail: any dynamic allocation is performed pre-time loop (i.e. in the non-performance critical part of the program), and all the multiplication is carried out within the time loop (where performance is critical).

Thanks for any help or suggestions!

Mike.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Fixed size matrices matrices will always be faster for 2x2 and 3x3 matrices. Regarding vectorization for the 3x3 case, you might try with a 4x3 matrix but don't expect much gain, especially with double precision without AVX.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft