Re:Clojure Linear Algebra Refresher: Eigenvalues and Eigenve...
by conistonwater on Tuesday June 06, 2017 @05:15PM
(#14501406)
I want to point out that axpy is an abbreviation of a * x + y, pronounced "a x plus y", hence axpy. So I disagree with "un-systematic".
Re:Clojure Linear Algebra Refresher: Eigenvalues and Eigenve...
by jacobolus on Tuesday June 06, 2017 @05:18PM
(#14501427)
“Systematic” would be e.g. `ab`, `ax`, `axpy`, `kx`, instead of `mm`, `mv`, `axpy`, `scal`. (Or whatever other preferred system, hopefully something carefully thought through rather than slapped together.)
The names are obviously meaningful, they’re just fairly ad-hoc and not guessable a priori.
Re:Clojure Linear Algebra Refresher: Eigenvalues and Eigenve...
by conistonwater on Tuesday June 06, 2017 @05:29PM
(#14501529)
I would say mm and mv name the types of the arguments, like a kind of Hungarian notation, which makes them okay. I think `ab`, `ax`, `axpy` make the problem worse: in the first two a and b are matrices and in the last a is a scalar. As for `kx`, anything named `k` is usually supposed to be an integer like everywhere else in mathematics (why not `ax` then?). As for scal-scale and nrm-norm, I have no idea why they did that, it seems wrong to me too.
Furthermore, it's a specialist expert subdomain—the names are already so standard that everybody who needs them already knows them or looks them up in a second. So I don't see "not guessable" as a valid criticism.
Re:Clojure Linear Algebra Refresher: Eigenvalues and Eigenve...
by dragandj on Tuesday June 06, 2017 @05:27PM
(#14501514)
I may offer you an angle here:
xpy uses x and y because x and y could be vectors, but can also be matrices
mm can not be used for vectors, only for matrices.
Of course, the main reason is that these are names used for the last 40+ years in the standard for this type of software, BLAS.
There’s no particularly good reason to shorten `norm` to `nrm` except to be cryptic.
Knowing that `mv` means “function that takes two arguments and multiplies the matrix in the first argument by the vector in the second argument” and that `axpb` means “takes three arguments, and multiplies a scalar by a vector and then adds it to another vector” and that `scal` means “takes two arguments and multiplies the scalar first argument by every element of the vector or matrix in the second argument” requires familiarity with BLAS. In general the names are fairly un-systematic. Once you’ve learned them reading code is reasonably straight-forward (albeit much less clear than code written using more explicit syntax like you’d find in Matlab or similar), but writing code is going to require either frequent trips to the docs or some time spent on memorization.