Commit 303ee78b authored by Davis King's avatar Davis King

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

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403797
parent 2bdd9bf2
...@@ -372,9 +372,12 @@ namespace dlib ...@@ -372,9 +372,12 @@ namespace dlib
matrix<column_matrix_type,0,1,mem_manager_type > Vx; matrix<column_matrix_type,0,1,mem_manager_type > Vx;
if (lambda == 0 || output_looe) 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()); Vx.set_size(proj_x.size());
for (long i = 0; i < proj_x.size(); ++i) 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; the_lambda = lambda;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment