Commented by rcurtin on 14 Apr 43902262 02:48 UTC
Thanks for double-checking my work. :)
In MATLAB writing things as vectorized can often result in much faster evaluation, but that doesn't apply so much in this case. Internal Armadillo code often uses for loops in the exact same way I did. What I'm trying to avoid is the allocation and filling of a big vector of ones, when that isn't actually necessary to get the correct result. When I have a main executable running (I'm working on this now, albeit a little slowly), I'll test both implementations and report my results back, but I'm nearly certain that in this case the non-vectorized implementation will be faster.
You are correct about the regularization, though. Thank you for pointing it out, because the tests were also written incorrectly. I've fixed the issues in r16065 and r16066.