Minor change to get better cache locality. Gives a nice speedup though.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403797
This commit is contained in:
Davis King 2010-07-28 23:50:20 +00:00
parent 2bdd9bf2c7
commit 303ee78bdd
1 changed files with 4 additions and 1 deletions

View File

@ -372,9 +372,12 @@ namespace dlib
matrix<column_matrix_type,0,1,mem_manager_type > Vx;
if (lambda == 0 || output_looe)
{
// Save the transpose of V into a temporary because the subsequent matrix
// vector multiplies will be faster (because of better cache locality).
const general_matrix_type transV(trans(V));
Vx.set_size(proj_x.size());
for (long i = 0; i < proj_x.size(); ++i)
Vx(i) = squared(trans(V)*proj_x(i));
Vx(i) = squared(transV*proj_x(i));
}
the_lambda = lambda;