News for hackers. Stuff that matters.
Re:Friends don't let friends use loops by bmh100 on Wednesday July 30, 2014 @06:54PM (#8111430)
Solid, simple post. A similar lesson applies to performing numerical operations on a set of numbers, when linear algebra could be used instead. The performance differences are huge.
Re:Friends don't let friends use loops by dagurp on Wednesday July 30, 2014 @07:09PM (#8111495)
I would love to see an example if you have one.
Re:Friends don't let friends use loops by bmh100 on Thursday July 31, 2014 @12:06AM (#8112407)
Check out this example with pies: http://www.mathsisfun.com/algebra/matrix-multiplying.html

Now, you might often see this particular problem in terms of database queries, and that is fine. But the uses I have seen of linear algebra in machine learning are essential to achieving performance. There, the algorithms are often highly iterative, using the same exact source data. To perform such calculations with a loop is extremely inefficient. Even chasing pointers can be a significant cost. There is a reason why Fortran code is generally faster than C for linear algebra out of the box.

Also see: http://stackoverflow.com/a/146186