python中mat是什麼意思?
本文教程操作環境:windows7系統、Python 3.9.1,DELL G3電腦。
python的numpy庫提供矩陣運算的功能,因此我們在需要矩陣運算的時候,需要匯入numpy的包。
from numpy import * ; #匯入numpy的庫函式 import numpy as np; #這個方式使用numpy的函式時,需要以np.開頭。
建立矩陣
>>> m= np.mat([1,2,3]) #建立矩陣 >>> m matrix([[1, 2, 3]]) >>> m[0] #取一行 matrix([[1, 2, 3]]) >>> m[0,1] #第一行,第2個資料
矩陣乘法
mat()函式中矩陣的乘積可以使用(星號) * 或 .dot()函式,其結果相同。
a*b
注意:mat()函式中資料可以為字串以分號(;)分割,或者為列表形式以逗號(,)分割。
a = np.mat([[1,2,3],[4,5,6]]) b = np.mat('1,2,3;4,5,6')
以上就是python的numpy庫的mat()函式介紹,希望能對你有所幫助喲~
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/1916/viewspace-2830767/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- python中return是什麼意思?Python
- python中global是什麼意思?Python
- python 是什麼意思Python
- Python中的rad是什麼意思?Python
- mysql中是什麼意思?MySql
- js 中~~是什麼意思?JS
- fluent python是什麼意思Python
- Python是什麼意思?Python有什麼用?Python
- C++中::是什麼意思C++
- mysql中的“=”是什麼意思MySql
- python 複數是什麼意思Python
- python中len什麼意思Python
- Python是什麼意思?Python幹什麼用的?Python
- JQuery中$(document)是什麼意思有什麼作用jQuery
- javascript中window.$是什麼意思JavaScript
- ->在c++中是什麼意思C++
- 在python裡int是什麼意思Python
- python裡面cv是什麼意思Python
- ITIL是什麼意思?ITIL是什麼?
- 英文Python是什麼意思?學Python需要什麼基礎?Python
- Linux中gpgcheck是什麼意思?作用是什麼?LinuxGC
- 域名解析中“TTL”是什麼意思?
- TypeScript 中的字面量是什麼意思TypeScript
- Linux中建立group是什麼意思?Linux
- c++中 -> 是什麼意思,如何使用C++
- C#中的 int?是什麼意思C#
- HTML是什麼意思?HTML
- Fastboot是什麼意思?ASTboot
- python UDP程式設計是什麼意思?PythonUDP程式設計
- python資料處理是什麼意思Python
- oracle 表中的rowid是什麼意思Oracle
- OpenCV中的CV_EXPORT是什麼意思OpenCVExport
- 請教:Jive中的moderate是什麼意思?
- 什麼是API介面,具體是什麼意思?API
- jquery庫是什麼意思jQuery
- JavaScript Token是什麼意思JavaScript
- 加簽是什麼意思?
- Python多執行緒是什麼意思?有什麼優勢?Python執行緒