# 矩陣運算 | repmat() 函數

| | | |

`numpy.matlib.repmat()` —這是在 numpy 中進行矩陣運算的另一個函數。返回重複的 0-D、1-D 或 2-D 數組，或 M x N 矩陣。

a: [array_like] 要重複的輸入數組或矩陣。
m, n: [int] a 沿第一和第二軸重複的次數。

 ` # Python 程序解釋 `` # numpy.matlib. repmat() function `` # 導入 numpy 庫和矩陣 `` import ` ` numpy as geek ` ` import ` ` numpy .matlib ` ` # 使用`` # 數組函數`創建輸入數組代碼>` in_arr ` ` = ` ` geek.array ([[` ` 1 ` `, ` ` 0 ` ` , ` ` 2 ` `], [ 3 , 4 , 5 ]]) ``打印 code> ( "輸入數組" , in_arr) `` # 創建一個新數組 # 使用repmat()函數 out_mat = geek.matlib.repmat (in_arr, <代碼類 = "值"> 2 <代碼類 = "普通">, <代碼類 = "值"> 3 <代碼類 = "普通">) print ("輸出重複矩陣：" , out_mat) ` 輸出：`I輸入數組 [[ 1 0 2] [3 4 5]] 輸出重複矩陣： [[1 0 2 1 0 2 1 0 2] [3 4 5 3 4 5 3 4 5] [1 0 2 1 0 2 1 0 2] [3 4 5 3 4 5 3 4 5]] `代碼#2： ` # Python程序解釋`` # numpy.matlib.repmat()函數` ` # import numpy library 和 matrix `` import ` ` numpy as geek `` import ` ` numpy.matlib `` # 使用 `` # 橙色函數創建一個輸入數組 `` in_arr ` ` = ` ` geek.arange (` ` 3 ` `) ` ` print ` ` (` ` "輸入數組" ` `, in_arr) `` # 創建一個新數組 `` # 使用 repmat() 函數 `` out_mat ` ` = ` ` geek.matlib.repmat (in_arr, ` ` 2 ` `, ` ` 2 ` `) `` print ` ` (` ` "輸出重複矩陣：" ` `, out_mat) `

`輸入數組[0 1 2] 輸出重複矩陣： [[0 1 2 0 1 2] [0 1 2 0 1 2]] `

## Shop

Best Python online courses for 2022

\$

Best laptop for Fortnite

\$

Best laptop for Excel

\$

Best laptop for Solidworks

\$

Best laptop for Roblox

\$

Best computer for crypto mining

\$

Best laptop for Sims 4

\$

Best laptop for Zoom

\$499

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

NUMPYNUMPY

How to convert Nonetype to int or string?

NUMPYNUMPY

How to specify multiple return types using type-hints

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

## Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method