What would these classes offer over these simple functions: def rvec(x): return x[...,np.newaxis,:]def cvec(x): return x[...,:,np.newaxis]
That also makes rvec(x) + cvec(y) behave in the least surprising way, with no extra work Eric On Sat, 1 Jul 2017 at 23:32 Charles R Harris <charlesr.har...@gmail.com> wrote: > Hi All, > > The '@' operator works well with stacks of matrices, but not with stacks > of vectors. Given the recent addition of '__array_ufunc__', and the intent > to make `__matmul__` use a ufunc, I've been wondering is it would make > sense to add ndarray subclasses 'rvec' and 'cvec' that would override that > operator so as to behave like stacks of row/column vectors. Any other ideas > for the solution to stacked vectors are welcome. > > Thoughts? > > Chuck > > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@python.org > https://mail.python.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion