-1

Wanna define a matrix where all elements should be zero. How can I do this?

  • Many people use [numpy.zeros](https://numpy.org/doc/stable/reference/generated/numpy.zeros.html) for this if they are doing anything serious with matrices. With pure python I think you are left with list comprehensions and/or loops. – Mark Dec 25 '20 at 04:50

1 Answers1

0

You can use the zeros function in numpy as:

import numpy as np

b = np.zeros((2,1)) # numpy.zeros(shape, dtype = None, order = 'C')
print(b)

Output

[[0.]
 [0.]]
Adit Goyal
  • 36
  • 4