从欠定系统中删除不可解方程 [英] Removing unsolvable equations from an underdetermined system

查看:97
本文介绍了从欠定系统中删除不可解方程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序尝试求解线性方程组.为此,它将矩阵coeff_matrix和向量value_vector组合在一起,并使用特征值来解决它们,例如:

My program tries to solve a system of linear equations. In order to do that, it assembles matrix coeff_matrix and vector value_vector, and uses Eigen to solve them like:

Eigen::VectorXd sol_vector = coeff_matrix
        .colPivHouseholderQr().solve(value_vector);

问题在于系统可以被过度确定也可以被确定不足.在前一种情况下,Eigen提供了正确或不正确的解决方案,而我使用coeff_matrix * sol_vector - value_vector来检查解决方案.

The problem is that the system can be both over- and under-determined. In the former case, Eigen either gives a correct or uncorrect solution, and I check the solution using coeff_matrix * sol_vector - value_vector.

但是,请考虑以下方程组:

However, please consider the following system of equations:

a + b - c     =  0
        c - d =  0
        c     = 11
      - c + d =  0

在这种情况下,Eigen可以正确求解后三个方程,但也可以给出ab的解.

In this particular case, Eigen solves the three latter equations correctly but also gives solutions for a and b.

我想实现的是,只有那些只有一个解的方程式可以被求解,而其余的方程式(这里的第一个方程式)将保留在系统中.

What I would like to achieve is that only the equations which have only one solution would be solved, and the remaining ones (the first equation here) would be retained in the system.

换句话说,我正在寻找一种方法,以找出当时可以在给定方程组中求解的方程,而不能求解,因为存在多个解决方案.

In other words, I'm looking for a method to find out which equations can be solved in a given system of equations at the time, and which cannot because there will be more than one solution.

您能提出实现此目标的任何好方法吗?

Could you suggest any good way of achieving that?

编辑:请注意,在大多数情况下,矩阵不会是正方形的.我在这里又增加了一行,只是为了说明过高确定也可能发生.

Edit: please note that in most cases the matrix won't be square. I've added one more row here just to note that over-determination can happen too.

推荐答案

我认为您想要的是奇异值分解(SVD ),它将为您提供所需的确切信息.在SVD之后,将只求解一个方程组",并且该方程组是伪逆的.还将为您提供零空间(无限解来自何处)和左零空间(不一致来自何处,即无解).

I think what you want to is the singular value decomposition (SVD), which will give you exact what you want. After SVD, "the equations which have only one solution will be solved", and the solution is pseudoinverse. It will also give you the null space (where infinite solutions come from) and left null space (where inconsistency comes from, i.e. no solution).

这篇关于从欠定系统中删除不可解方程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆