but... what else is there, in life? Flipping big matrices around is nearly everything I do, and the python stuff seems too cumbersome for me to bother.
but... what else is there, in life? Flipping big matrices around is nearly everything I do, and the python stuff seems too cumbersome for me to bother.
import numpy
import scipy.sparse
import scipy.sparse.linalg
just to begin writing something.You cannot create a literal array without calling a function. You cannot concatenate arrays without calling a function, and moreover this function has a different name depending on whether your arrays are full or sparse. The @ notation for matrix products is horrendous (and .dot is even worse). Arrays are not first-class objects of the language, and you have to use an external library. This is more infuriating by the fact that other, more complex data structures like dictionaries or strings are natively supported, even if they are mostly useless for numerical computation.
Compare the clean matrix flipping in octave
z = [ kron(speye(rows(y)), x) ; kron(y, speye(cols(x))) ]
to the python monstrosity z = scipy.sparse.vstack([
scipy.sparse.kron(scipy.sparse.eye(y.shape[0]), x),
scipy.sparse.kron(y, scipy.sparse.eye(x.shape[1]))
]) from scipy.sparse import eye, kron
from scipy.spare import vstack as vs
z = vs([
kron(eye(y.shape[0]), x),
kron(y, eye(x.shape[1]))
])The thing that kills my soul is the need for the "vs" function. Why aren't the symbols [] not enough ?