numpy zeros矩陣
Zeros Matrix - When all the entries of a matrix are one, then it is called a zeros matrix. It may be of any dimension (MxN).
零矩陣 -當矩陣的所有條目均為1時,則稱為零矩陣。 它可以是任何尺寸( MxN )。
Properties:
特性:
-
The determinant of the matrix is 0.
矩陣的行列式為0。
-
The Rank of any zeros Matrix is 1.
任何零矩陣的秩為1。
In python, we have an inbuilt function (defined in numpy library) numpy.zeros() to define the zeros matrix. Here is the code with examples.
在python中,我們有一個内置函數(在numpy庫中定義) numpy.zeros()來定義零矩陣。 這是帶有示例的代碼。
使用numpy.zeros()的零矩陣的Python代碼 (Python code for zeros matrix using numpy.zeros())
# Linear Algebra Learning
# Zeros Matrix
import numpy as np
a = np.zeros([3,5])
b = np.zeros([6,6])
c = np.zeros([9,5])
#printing the matrices
print("\n----Zeros Matrix (3x5)----\n",a)
print("\n----Zeros Matrix (9x5)----\n",c)
print("\n----Zeros Matrix (6x6)----\n",b)
Output: 輸出: ----Zeros Matrix (3x5)----
[[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]]
----Zeros Matrix (9x5)----
[[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0.]]
----Zeros Matrix (6x6)----
[[0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 0. 0.]]
翻譯自: https://www.includehelp.com/python/zeros-matrix-using-numpy-zeros.aspx
numpy zeros矩陣