c ++犰狳

这是我第一次发帖...

有什么方法可以在另一个向量的空间中计算向量? 我不需要这个基础,只有一个向量位于null空间中。

我已经尝试使用solve()方法 -

colvec x(3);
x = solve(A,B);

其中A是mat的3x3矩阵 -

2 2 2
3 3 3
4 4 4

而B是colvec类型的零向量 -

0
0
0

但程序终止抛出以下错误 -

error: solve(): solution not found
terminate called after throwing an instance of 'std::runtime_error'
  what():

我之前使用了solve()方法并且获得了完美的结果,但在这种简单情况下它似乎不起作用。 这是因为方程式有多种解决方案? 如果是这样,是否有任何解决方法,以任何其他方式,我可以在空间中获得一个向量?

任何帮助,将不胜感激。

编辑:

我尝试了svd(mat U,vec s,mat V,mat X,method =“standard”)方法,并且从V的列中获得了X的null空间。我只是想知道是否有任何方法来改进答案的精确度。
谢谢!


在最近版本的犰狳库中,您可以使用null()函数找到矩阵的零空间的标准正交基。 请参阅http://arma.sourceforge.net/docs.html#null上的文档。 该功能在版本5.400(2015年8月)中添加。

链接地址: http://www.djcxy.com/p/75371.html

上一篇: c++ armadillo

下一篇: How edit/change View from layout in RemoteView or create RemoteView from View?