I'm trying to port some of my code from matlab to python, and some of it uses the bsxfun() function for virtual replication followed by multiplication or division (I also use it for logical operations). I'd like to be able to do this without actually replicating the vector (either with a function or with some kind of diagonal matrix) before multiplying or dividing to save on memory and time.
If there's an equivalent of bsxfun in a C library of some kind, that would of course also work.
Python is very easy to use compared to matlab bsxfun(x) in python numpy can be easily done by ... in array[], e.g. m[...,:] You can try this: