1. TOP
  2. KEYENCE
  3. KV-X/KV
  4. 計算
  5. 行列

KVKV-X

行列

加算 (matADD)

KV
matADDFB
KV-X
matADDFBKVX
入出力
mat1
行列 [0..9,0..9]
mat2
行列 [0..9,0..9]
ColNum
列数
RowNum
行数
出力
result
行列 [0..9,0..9]

【例】

入出力
mat1
\begin{bmatrix} 1,&2,&3 \\ 2,&3,&4 \\ 3,&4,&5 \\ \end{bmatrix}
mat2
\begin{bmatrix} 3,&2,&1 \\ 4,&3,&2 \\ 5,&4,&3 \\ \end{bmatrix}
ColNum
3
RowNum
3
出力
result
\begin{bmatrix} 4,&4,&4 \\ 6,&6,&6 \\ 8,&8,&8 \\ \end{bmatrix}

計算式

\[ \begin{bmatrix} a_{11} & a_{12} & \ldots & a_{1n} \\ a_{21} & a_{22} & \ldots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{nl} & a_{n2} & \ldots & a_{nn} \end{bmatrix} + \begin{bmatrix} b_{11} & b_{12} & \ldots & b_{1n} \\ b_{21} & b_{22} & \ldots & b_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ b_{nl} & b_{n2} & \ldots & b_{nn} \end{bmatrix} = \begin{bmatrix} a_{11}+b_{11} & a_{12}+b_{12} & \ldots & a_{1n}+b_{1n} \\ a_{21}+b_{21} & a_{22}+b_{22} & \ldots & a_{2n}+b_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{nl}+b_{nl} & a_{n2}+b_{n2} & \ldots & a_{nn}+b_{nn} \end{bmatrix} \]


減算 (vecSUB)

KV
matSUBFB
KV-X
matSUBFBKVX
入出力
mat1
行列 [0..9,0..9]
mat2
行列 [0..9,0..9]
ColNum
列数
RowNum
行数
result
行列 [0..9,0..9]

【例】

入力
a
\begin{bmatrix} 1,&2,&3 \\ 2,&3,&4 \\ 3,&4,&5 \\ \end{bmatrix}
b
\begin{bmatrix} 3,&2,&1 \\ 4,&3,&2 \\ 5,&4,&3 \\ \end{bmatrix}
ColNum
3
RowNum
3
出力
result
\begin{bmatrix} -2,&0,&2 \\ -2,&0,&2 \\ -2,&0,&2 \\ \end{bmatrix}

計算式

\[ \begin{bmatrix} a_{11} & a_{12} & \ldots & a_{1n} \\ a_{21} & a_{22} & \ldots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{nl} & a_{n2} & \ldots & a_{nn} \end{bmatrix} - \begin{bmatrix} b_{11} & b_{12} & \ldots & b_{1n} \\ b_{21} & b_{22} & \ldots & b_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ b_{nl} & b_{n2} & \ldots & b_{nn} \end{bmatrix} = \begin{bmatrix} a_{11}-b_{11} & a_{12}-b_{12} & \ldots & a_{1n}-b_{1n} \\ a_{21}-b_{21} & a_{22}-b_{22} & \ldots & a_{2n}-b_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{nl}-b_{nl} & a_{n2}-b_{n2} & \ldots & a_{nn}-b_{nn} \end{bmatrix} \]


定数倍 (matMUL)

KV
matMULFB
KV-X
matMULFBKVX
matMULFB
入力
mat
行列 [0..9,0..9]
kk
倍率
ColNum
列数
RowNum
行数
出力
result
行列 [0..9,0..9]

【例】

入力
mat
\begin{bmatrix} 1,&2,&3 \\ 2,&3,&4 \\ 3,&4,&5 \\ \end{bmatrix}
kk
2.0
ColNum
3
RowNum
3
出力
result
\begin{bmatrix} 2,&4,&6 \\ 4,&6,&8 \\ 6,&8,&10 \\ \end{bmatrix}

計算式

\[ k \begin{bmatrix} a_{11} & a_{12} & \ldots & a_{1n} \\ a_{21} & a_{22} & \ldots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{nl} & a_{n2} & \ldots & a_{nn} \end{bmatrix} = \begin{bmatrix} ka_{11} & ka_{12} & \ldots & ka_{1n} \\ ka_{21} & ka_{22} & \ldots & ka_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ ka_{nl} & ka_{n2} & \ldots & ka_{nn} \end{bmatrix} \]


アダマール積 (matMultiply)

KV
matMultiplyFB
KV-X
matMultiplyFBKVX
入力
mat1
行列 [0..9,0..9]
mat2
行列 [0..9,0..9]
ColNum
列数
RowNum
行数
出力
result
行列 [0..9,0..9]

【例】

入力
mat1
\begin{bmatrix} 1,&2,&3 \\ 2,&3,&4 \\ 3,&4,&5 \\ \end{bmatrix}
mat2
\begin{bmatrix} 3,&2,&1 \\ 4,&3,&2 \\ 5,&4,&3 \\ \end{bmatrix}
ColNum
3
RowNum
3
出力
result
\begin{bmatrix} 3,&4,&3 \\ 8,&9,&8 \\ 15,&16,&15 \\ \end{bmatrix}

\[ \begin{bmatrix} a_{11} & a_{12} & \ldots & a_{1n} \\ a_{21} & a_{22} & \ldots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{nl} & a_{n2} & \ldots & a_{nn} \end{bmatrix} \circ \begin{bmatrix} b_{11} & b_{12} & \ldots & b_{1n} \\ b_{21} & b_{22} & \ldots & b_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ b_{nl} & b_{n2} & \ldots & b_{nn} \end{bmatrix} = \begin{bmatrix} a_{11}b_{11} & a_{12}b_{12} & \ldots & a_{1n}b_{1n} \\ a_{21}b_{21} & a_{22}b_{22} & \ldots & a_{2n}b_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{nl}b_{nl} & a_{n2}b_{n2} & \ldots & a_{nn}b_{nn} \end{bmatrix} \]


内積 (matDot)

KV
matDotFB
KV-X
matDotFBKVX
入出力
mat1
行列 [0..9,0..9]
mat2
行列 [0..9,0..9]
ColNum
列数
RowNum
行数
出力
result
結果

【例】

入力
mat1
\begin{bmatrix} 1,&2,&3 \\ 2,&3,&4 \\ 3,&4,&5 \\ \end{bmatrix}
mat2
\begin{bmatrix} 3,&2,&1 \\ 4,&3,&2 \\ 5,&4,&3 \\ \end{bmatrix}
出力
result
81
\[ \begin{bmatrix} a_{11} & a_{12} & \ldots & a_{1n} \\ a_{21} & a_{22} & \ldots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{nl} & a_{n2} & \ldots & a_{nn} \end{bmatrix} \bullet \begin{bmatrix} b_{11} & b_{12} & \ldots & b_{1n} \\ b_{21} & b_{22} & \ldots & b_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ b_{nl} & b_{n2} & \ldots & b_{nn} \end{bmatrix} = \begin{align} &a_{11}b_{11} + a_{12}b_{12} + \ldots + a_{1n}b_{1n} \\ &+ a_{21}b_{21} + a_{22}b_{22} + \ldots + a_{2n}b_{2n} \\ &+ \ldots \\ &+ a_{nl}b_{nl} + a_{n2}b_{n2} + \ldots + a_{nn}b_{nn} \\ \end{align} \]

外積 (matCross)

KV
matCrossFB
KV-X
matCrossFBKVX
入力
mat1
行列 [0..9,0..9]
Mat1_ColNum
mat1列数
Mat1_RowNum
mat1行数
mat2
行列 [0..9,0..9]
Mat2_ColNum
mat2列数
Mat2_RowNum
mat2行数
出力
result
結果 [0..9,0..9]

【例】

入力
mat1
\begin{bmatrix} 1,&2,&3 \\ 2,&3,&4 \\ 3,&4,&5 \\ \end{bmatrix}
mat2
\begin{bmatrix} 3,&2,&1 \\ 4,&3,&2 \\ 5,&4,&3 \\ \end{bmatrix}
Mat1_ColNum
3
Mat1_RowNum
3
Mat2_ColNum
3
Mat2_RowNum
3
出力
result
\begin{bmatrix} 26,&20,&14 \\ 38,&29,&20 \\ 50,&38,&26 \\ \end{bmatrix}

計算式

\[ \begin{bmatrix} a_{11} & a_{12} & \ldots & a_{1n} \\ a_{21} & a_{22} & \ldots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{nl} & a_{n2} & \ldots & a_{nn} \end{bmatrix} \times \begin{bmatrix} b_{11} & b_{12} & \ldots & b_{1n} \\ b_{21} & b_{22} & \ldots & b_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ b_{nl} & b_{n2} & \ldots & b_{nn} \end{bmatrix} \]


転置行列 (matT)

KV
matTFB
KV-X
matTFBKVX
入力
mat
行列 [0..9,0..9]
ColNum
列数
RowNum
行数
出力
result
結果 [0..9,0..9]

【例】

入力
mat
\begin{bmatrix} 1,&2,&3 \\ 4,&5,&6 \\ 7,&8,&9 \\ \end{bmatrix}
ColNum
3
RowNum
3
出力
result
\begin{bmatrix} 1,&4,&7 \\ 2,&5,&8 \\ 3,&6,&9 \\ \end{bmatrix}

計算式

\[ ^tA= \begin{bmatrix} a_{11} & a_{12} & \ldots & a_{1n} \\ a_{21} & a_{22} & \ldots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{nl} & a_{n2} & \ldots & a_{nn} \end{bmatrix} = \begin{bmatrix} a_{11} & a_{21} & \ldots & a_{nl} \\ a_{12} & a_{22} & \ldots & a_{n2} \\ \vdots & \vdots & \ddots & \vdots \\ a_{1n} & a_{2n} & \ldots & a_{nn} \end{bmatrix} \]


逆行列 (matInv)

KV
matInvFB
KV-X
matInvFBKVX
入力
mat
行列 [0..9,0..9]
RowColNum
行数と列数
出力
result
結果 [0..9,0..9]

【例】

入力
mat
\begin{bmatrix} 1,&2,&0 \\ -1,&1,&2 \\ 2,&0,&1 \\ \end{bmatrix}
RowColNum
3
出力
result
\begin{bmatrix} 0.09,&-0.18,&0.36 \\ 0.45,&0.09,&-0.18 \\ -0.18,&0.36,&0.27 \\ \end{bmatrix}

計算式

\[ A^{-1}= \begin{bmatrix} a_{11} & a_{12} & \ldots & a_{1n} \\ a_{21} & a_{22} & \ldots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{nl} & a_{n2} & \ldots & a_{nn} \end{bmatrix} \]


行列式の計算 (matDet)

KV
matDetFB
KV-X
matDetFBKVX
入出力
mat
行列 [0..9,0..9]
RowColNum
行数と列数
出力
result
計算結果

【例】

入力
mat
\begin{bmatrix} 2,&-2,&4 \\ 2,&-1,&6 \\ 3,&-2,&12 \\ \end{bmatrix}
RowColNum
3
出力
out
8.0

計算式

\[ detA= \begin{bmatrix} a_{11} & a_{12} & \ldots & a_{1n} \\ a_{21} & a_{22} & \ldots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{nl} & a_{n2} & \ldots & a_{nn} \end{bmatrix} \]


この記事へのコメント