You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
lacpy routines are not optimal for copying the lower triangular part of a fat matrix #1183
Description
For the lower triangular part, the routines go through all columns and then below-diagonal entries in each column. However, for a matrix with a small height and a large width, unnecessary columns are looped, hurting performance.
Hmm, between the "let the compiler do this" and "let the user do this", I do not think I saw a clear argument for not implementing this trivial optimization in LAPACK ?
Activity
langou commentedon Jan 14, 2026
If I understand correctly, the idea is to change this line
lapack/SRC/dlacpy.f
Line 136 in 76a3a41
with something like
in DLACPY, SLACPY, ZLACPY and CLACPY.
This sounds good to me.
Three comments:
( 1 / 3 ) You would hope that the compiler automatically does the optimization when it sees:
I do not know whether compilers do this or not.
( 2 / 3 ) This proposed optimization could also be done in LANTR for example.
( 3 / 3 ) For LANTR, LACPY, etc., one idea might have been that the user would call
and not
and, if the latter, well, performance hit would ensue.
putianyi889 commentedon Jan 14, 2026
Very helpful. Adding this information to documentation would also close this issue IMO.
Since the 'U' part also has a
min, I would prefer your first solution.martin-frbg commentedon Apr 21, 2026
Hmm, between the "let the compiler do this" and "let the user do this", I do not think I saw a clear argument for not implementing this trivial optimization in LAPACK ?
putianyi889 commentedon Apr 22, 2026
My bad. I thought #14 fixed this.
Optimize lower triangular loops for fat matrix cases