天天看点

numpy zeros矩阵_零矩阵使用numpy.zeros()| 使用Python的线性代数

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矩阵

继续阅读