[Python-ideas] Construct a matrix from a list: matrix multiplication
Pavol Lisy
pavol.lisy at gmail.com
Sat Apr 1 01:22:12 EDT 2017
On 4/1/17, Franklin? Lee <leewangzhong+python at gmail.com> wrote:
> On Fri, Mar 31, 2017 at 3:58 AM, Chris Angelico <rosuav at gmail.com> wrote:
>> This keeps on coming up in one form or another - either someone
>> multiplies a list of lists and ends up surprised that they're all the
>> same, or is frustrated with the verbosity of the alternatives.
>> Can we use the matmul operator for this?
> In math, a number can be considered a 1-dimensional vector. You can
> multiply a 1-dimensional vector by an n-dimensional vector _as
> matrices_ to get the same result as scalar multiplication. Using it as
> a deep-copy multiplication operator might make things confusing when
> someone moves to or from Numpy.
Too late. ;)
[1, 1, 1] * 3
numpy.ones(3) * 3
PL.
More information about the Python-ideas
mailing list