日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

一个使用numpy.ones()的矩阵| 使用Python的线性代数

發布時間:2023/12/1 python 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 一个使用numpy.ones()的矩阵| 使用Python的线性代数 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Ones Matrix - When all the entries of a matrix are one, then it is called as ones matrix. It may be of any dimension (MxN).

一個矩陣 -當矩陣的所有條目均為1時,則稱為一個矩陣。 它可以是任何尺寸( MxN )。

Properties:

特性:

  • The determinant of the matrix is 1 (when the number of columns and rows are 1, i.e. there is only one element in the matrix) or 0 otherwise.

    矩陣的行列式為1(當行數為1時,即矩陣中只有一個元素),否則為0。

  • The Rank of any Ones Matrix is 1.

    任何人矩陣的等級是1。

In python, we have an inbuilt function (defined in numpy library) numpy.ones() to define the ones matrix. Here is the code with examples.

在python中,我們有一個內置函數(在numpy庫中定義) numpy.ones()來定義一個矩陣。 這是帶有示例的代碼。

使用numpy.ones()實現矩陣矩陣的Python代碼 (Python code for ones matrix using numpy.ones())

# Linear Algebra Learning Sequence # Ones matrix using numpy.ones() import numpy as npa = np.ones([3,5]) b = np.ones([6,6]) c = np.ones([9,5])#printing the matrices print("\n----Ones Matrix (3x5)----\n",a) print("\n----Ones Matrix (6x6)----\n",b) print("\n----Ones Matrix (9x5)----\n",c)

Output:

輸出:

----Ones Matrix (3x5)----[[1. 1. 1. 1. 1.][1. 1. 1. 1. 1.][1. 1. 1. 1. 1.]]----Ones Matrix (6x6)----[[1. 1. 1. 1. 1. 1.][1. 1. 1. 1. 1. 1.][1. 1. 1. 1. 1. 1.][1. 1. 1. 1. 1. 1.][1. 1. 1. 1. 1. 1.][1. 1. 1. 1. 1. 1.]]----Ones Matrix (9x5)----[[1. 1. 1. 1. 1.][1. 1. 1. 1. 1.][1. 1. 1. 1. 1.][1. 1. 1. 1. 1.][1. 1. 1. 1. 1.][1. 1. 1. 1. 1.][1. 1. 1. 1. 1.][1. 1. 1. 1. 1.][1. 1. 1. 1. 1.]]

翻譯自: https://www.includehelp.com/python/ones-matrix-using-numpy-ones.aspx

總結

以上是生活随笔為你收集整理的一个使用numpy.ones()的矩阵| 使用Python的线性代数的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。