如何在 Octave 中求逆矩阵和整数结果?
我想在 Octave 中得到一个可逆矩阵,但作为整数矩阵,所以:
x = [9,15;19,2];
inv(x)
这里我得到:
[-0.0074906, 0.0561798; 0.0711610, -0.0337079]
但我想得到 [22,17;25,21]
有人知道如何求逆矩阵吗?
I would like to get an invertible matrix in Octave but as integers matrix, so:
x = [9,15;19,2];
inv(x)
Here I get:
[-0.0074906, 0.0561798; 0.0711610, -0.0337079]
but I would like to get [22,17;25,21]
anyone knows how to invert a matrix?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
每个元素的逆是:
哪些结果
为什么要得到
[22,17;25,21]
?什么样的数学运算会产生这样的结果?The inverse of each element is:
Which results
Why you want to get
[22,17;25,21]
? What mathematical operation would yield such result?以八度音程反转矩阵:
您对矩阵的逆是什么感到困惑,这里没有人知道您想要的输出是什么,所以这里有一些线索。
如果对单位矩阵求逆,您将得到单位矩阵:
非方阵(m×n 矩阵,其中 m != n)没有逆矩阵
对对角线上为零的矩阵求逆会导致无穷大:
对具有完整值的矩阵求逆,如下所示:
了解逆函数底层发生的情况的描述:
https://www .khanacademy.org/math/precalculus/precalc-matrices/inverting_matrices/v/inverse-of-a-2x2-matrix
Invert a matrix in octave:
You are confused about what an inverse of a matrix is, don't nobody here knows what you want with your output, so here are some clues.
If you Invert an identity matrix, you get the identity matrix:
Non-square matrices (m-by-n matrices for which m != n) do not have an inverse
Inverting a matrix with a zero on the diagonal causes an infinity:
Inverting a matrix with full values like this:
For a description of what is happening under the hood of the inverse function:
https://www.khanacademy.org/math/precalculus/precalc-matrices/inverting_matrices/v/inverse-of-a-2x2-matrix
我很晚了,不知道如何有效地回答这个问题,但看起来你正在寻找矩阵的模逆,特别是 mod 26。
你必须自己实现 mod_inverse 函数,但算法应该很容易找到。如果这仅适用于小模值,那么线性搜索应该足够有效。
I'm very late to this and don't know how to answer the question efficiently, but it looks like you're looking to find the modular inverse of the matrix, in particular mod 26.
You have to implement the mod_inverse function by yourself, but the algorithm should be easy enough to find. If this is only for small modulus values, then a linear search should be efficient enough.