MIT has a course called The Missing Semester of Your CS Education [1]. It tells you about practical stuff that you need to know but isn't really taught in classes (shells, version control, build systems, package managers, VM's).
There needs to be something similar for linear algebra, it seems like there's a lot of folk knowledge and a big gap between what typical undergrad courses train you to do and what you encounter in actual practical problems.
(And don't get me started on all the weird linear algebra stuff they have going on in e.g. quantum physics.)
[1] https://stanford.edu/class/engr108/
[2] https://web.stanford.edu/~boyd/vmls/
[3] https://www.youtube.com/watch?v=oR6G1MUMveE
[4] https://ee263.stanford.edu/
[5] https://www.youtube.com/playlist?list=PL06960BA52D0DB32B
http://www.ma.man.ac.uk/~higham/papers/bibbase.php
including a brief note on the comparing "Top 10 Algorithms in Applied Mathematics" between 2000 and 2016 that may interest some:
https://nhigham.com/2016/03/29/the-top-10-algorithms-in-appl...
It'd be nice to see some meat on the bones and a few ripping yarns about the application end of applied math techniques .. eg: forming an enhanced image from tens (or hundreds) of thousands of multichannel spectral samples using a sensitivity adjusted SVD, and then removing the most common expected background to highlight the anomalies.
It's dry stuff in Linear Algebra, somewhat more exciting when searching for nuclear weapons in a forest or gold in a desert.
http://gregorygundersen.com/blog/2020/12/09/matrix-inversion...
E.g. Goodfellow et al did even worse than this sin in the Deep Learning book when they claimed the condition number for a square (but not necessarily normal) matrix is defined in terms of eigenvalues. This is false, but nevertheless see 4.2 in https://www.deeplearningbook.org/contents/numerical.html . When I've raised this with people in real life, I typically get some reflexive response that it should be a useful approximation, but as this blog points out, that isn't true either.
[1]: https://www.math.purdue.edu/~yipn/543/matrixExp19-I.pdf
Thanks for this excellent link.
8. [edit: oops that's already no 5] Not taking advantage of matrix structure (symmetric, sparse, banded, Toeplitz, ...)
9. Transposing a matrix (Like the inverse A^{-1}, the explicit transpose A^t is often not needed)
... if you only use the transpose once. If instead it is going to be used multiple times, explicitly computing the transpose can be a huge performance boost.
For dense matrices, it is typically used to exploit memory locality (i.e. to be prefetch- and cache-friendly).
For sparse matrices (your point 8), the advantage can be even more pronounced, sometimes the difference between being able to exploit sparsity, or not.
This is the sin no 5 of the article: "5. Not Exploiting Structure in the Matrix"
Most matrix libraries should make transpose, conjugate, and conjugate transpose just twiddling a bit on its internal representation--BLAS routines should have a parameter on them saying if the input matrix needs to be transposed and/or conjugated before doing an operation.
People who say "transpose is an O(1) operation because it just creates a view" aren't including the important detail of caches and access patterns impact on performance.
In computer graphics, the situation is often different. Usually, you have small matrices (kxk for k=2,3,4); a huge number of vectors; and you want to apply your matrix to all of those vectors. Very often, these matrices have very well known forms and also known well behaved inverses. There isn't really a significant computational cost in computing the inverse (you'll very often write down its formula by hand), and conditioning is usually not an issue (consider a rotation matrix for example or undoing translations with homogeneous coordinates).
Since transformation matrices have simple structure, you can invert them much much faster.
Ex: inverse(R, u) is (R^T, -R^T * u)
I remember learning in algebra to solve this equation exactly the way he described and said we don't use. You multiply both sides by 1 / 7 which cancels the 7 on the left side, because 1 / 7 is the inverse of 7.
Now I just implicitly divide both sides by 7, but I'm still solving the equation by using the inverse of 7...
The cheap way is to compute 21/7.
The hard way is to compute 1/7 (one floating point operation), and then multiply it by 21 (another floating point operation).
With matrices, the discrepancy in work and possibly precision between "solve Ax=b" and "compute x = A^-1 b" can be very large.
well you just 1/sqrt(7) * sqrt(7)x = 1/sqrt(7) * 21
so x = sqrt(7)^2 * 3 / sqrt(7) = sqrt(7) * 3
but you didn't compute the inverse did you, and neither did i. you factored 21 and used the cancellation law (ax = ay => x = y)
Most of the industries are dominated by subject matter experts who write code.
- For intuition: https://www.youtube.com/watch?v=fNk_zzaMoSs
- For rigor: https://ocw.mit.edu/courses/18-06-linear-algebra-spring-2010...
- For code: https://codingthematrix.com/
- For numerical/algorithmic details: https://people.maths.ox.ac.uk/trefethen/text.html