Hacker News new | past | comments | ask | show | jobs | submit login

What kind of flipping are you talking about? I can transpose a matrix in numpy with X.T. What is cumbersome about this?



In python, I hate hate hate having to do

    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]))
          ])


lol don't blame the tools for your ignorance of them

    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]))
          ])


It's exactly the same thing that I wrote, isn't it?

The thing that kills my soul is the need for the "vs" function. Why aren't the symbols [] not enough ?


Because python is a different language from Matlab and python lists are lists and note 1d arrays?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: