ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

旋转位置编码笔记: R矩阵相乘推导

2026/8/14 14:18:29 拓冰建站 浏览量
旋转位置编码笔记: R矩阵相乘推导

学习旋转位置编码的时候 (https://kexue.fm/archives/8265),发现对于Rm和Rn转置矩阵相乘的结果不太理解,遂做推导并记笔记。推导完成之后,感觉这里面还是有一些蹊跷,可以进一步挖掘的,以后再思考下。推导过程如下:

\[\\ \]

\[{R}_{{m}} ^{{T}} {R}_{{n}} \\ \]

\[=\begin{bmatrix}{{cosm}\theta}&{{sinm}\theta}\\{−{sinm}\theta}&{{cosm}\theta}\end{bmatrix}\begin{bmatrix}{\mathrm{cos}\:{n}\theta}&{−{sinn}\theta}\\{{sinn}\theta}&{{cosn}\theta}\end{bmatrix} \\ \]

\[=\begin{bmatrix}{{cosm}\theta{cosn}\theta+{sinm}\theta{sinn}\theta}&{−{cosm}\theta{sinn}\theta+{sinm}\theta{cosn}\theta}\\{−{sinm}\theta{cosn}\theta+{cosm}\theta{sinn}\theta}&{{sinm}\theta{sinn}\theta+{cosm}\theta{cosn}\theta}\end{bmatrix} \\ \]

\[=\begin{bmatrix}{{cos}\left({n}−{m}\right)\theta}&{−{sin}\left({n}−{m}\right)\theta}\\{{sin}\left({n}−{m}\right)\theta}&{{cos}\left({n}−{m}\right)\theta}\end{bmatrix} \\ \]

因此

\[{R}_{{n}−{m}} ={R}_{{m}} ^{{T}} {R}_{{n}} \\ \]