如何在Android中进行矩阵求逆和乘法?
给定 2 个矩阵:
public float[] mRi = new float[16];
public float[] mR = new float[16];
的两个读数的输出
- 这些将是来自
SensorManager.getRotationMatrix(mR, x, y, z)
和 SensorManager.getRotationMatrix(mRi, x, y, z)
code>
所以会有两个 4x4 矩阵,
我想得到以下方程的结果:
ResultMtrix=inverse(mRi)*mR
事实上我知道它是否适用于 invertM()
和 multiplyMM()
但我不知道如何使用矩阵来做到这一点。
你能帮忙吗?
Given 2 matrices:
public float[] mRi = new float[16];
public float[] mR = new float[16];
These will be the outputs of two readings from
SensorManager.getRotationMatrix(mR, x, y, z)
andSensorManager.getRotationMatrix(mRi, x, y, z)
So there will be two 4x4 matrices which,
I want to get the result of the following equation:
ResultMtrix=inverse(mRi)*mR
In fact I have the idea whether it works with invertM()
and multiplyMM()
but I don't have a clue on how to do it with the matrices.
Can you help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嘿伙计,我假设它们是 4x4 矩阵(16 个元素)...您可以使用高斯乔丹消除 http://en.wikipedia.org/wiki/Gauss%E2%80%93Jordan_elimination 用于反演。矩阵乘法的描述随处可见,甚至比矩阵求逆还要多。
Hey guy, I assume they are 4x4 matrix (16 elements)... You can use Gauss-Jordan elimination http://en.wikipedia.org/wiki/Gauss%E2%80%93Jordan_elimination for inversion. Matrix multiplication is described about everywhere, even more than matrix inversion.
您描述的矩阵实际上是一维向量,所以我假设您所说的逆实际上是转置。这种情况下的计算非常简单:
方法
测试
输出
The matrices you are describing are actually uni-dimensional vectors, so I am assuming that what you call inverse is actually transpose. The calculation in that case is quite simple:
Methods
Test
Output