有没有一种很好的方法可以在特征p> 0的字段中找到矩阵的等级?(Is there a good way to find the rank of a matrix in a field of ch

编程入门 行业动态 更新时间:2024-10-24 06:31:47
有没有一种很好的方法可以在特征p> 0的字段中找到矩阵的等级?(Is there a good way to find the rank of a matrix in a field of characteristic p>0?)

我需要一种有效的算法或已知方法来确定具有正特性场中的系数的矩阵A 的数学秩 。

例如,在5个元素的有限域中,我有以下矩阵:

import numpy A=[[2,3],[3,2]] print numpy.linalg.matrix_rank(A)

该方法给出了2的结果,但在特征5中,该矩阵具有等级1,因为[2,3]+[3,2]=[0,0] 。

I need an efficient algorithm or a known way to determine the mathematical rank of a matrix A with coefficients in a field of positive characteristic.

For example, in the finite field of 5 elements I have the following matrix:

import numpy A=[[2,3],[3,2]] print numpy.linalg.matrix_rank(A)

This method gives me the result of 2, but in characteristic 5 this matrix has rank 1 since [2,3]+[3,2]=[0,0].

最满意答案

Numpy没有内置的有限字段支持。 代码中的矩阵A被视为实数矩阵,因此具有等级2。

如果你真的需要使用Numpy支持有限字段,你必须自己定义自己的数据类型和算术运算,如下所示。 当然存在关于正确错误处理的问题(例如除以零)。

即使这样,也必须重写许多常用例程以支持您的字段数据类型。 例如,从numpy.linalg.matrix_rank文档中,例程使用奇异值分解(SVD),它没有为有限域定义,因此您必须自己编码排名算法。

至于算法本身,你可以尝试沿着这些线实现普通的高斯消除,但这可能是一个痛苦的问题,并且非常慢,所以你可能会更好地使用像Sage这样的其他工具/软件包。

Numpy doesn't have built-in support for finite fields. The matrix A in your code is treated as a matrix of real numbers, and hence has rank 2.

If you really need to support finite fields with Numpy, you'll have to define your own data type along with the arithmetic operations yourself, as shown here. There are of course the concerns about proper error handling (like divide by zero).

Even then, many common routines will have to be rewritten to support your field data types. For example, from the numpy.linalg.matrix_rank documentation, the routine uses Singular Value Decomposition (SVD), which is not well defined for finite fields, so you'll have to code the rank finding algorithm yourself.

As for the algorithm itself, you could try implementing plain old Gaussian Elimination along these lines, but this can be a pain in the neck and really slow, so you will likely be better off with other tools/packages like Sage.

更多推荐

本文发布于:2023-08-04 08:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1413070.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:很好   矩阵   字段   特征   等级

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!