xxjjnn - 1 year ago 65

Python Question

I want to perform an element wise multiplication, to multiply two lists together by value in Python, like we can do it in Matlab.

This is how I would do it in Matlab.

`a = [1,2,3,4]`

b = [2,3,4,5]

a .* b = [2, 6, 12, 20]

A list comprehension would give 16 list entries, for every combination

`x * y`

`x`

`a`

`y`

`b`

If anyone is interested why, I have a dataset, and want to multiply it by

`Numpy.linspace(1.0, 0.5, num=len(dataset)) =)`