c++ - 矩阵模板库矩阵求逆

标签 c++ math stl boost linear-algebra

我正在尝试使用 Boost boost_1_37_0 和 MTL mtl4-alpha-1-r6418 版本对矩阵求逆。我似乎无法找到矩阵求逆代码。我在谷歌上搜索了示例,它们似乎引用了上述版本中似乎缺少的 lu.h。有什么提示吗?

@Matt建议复制 lu.h,但这似乎来自 MTL2 而不是 MTL4。我在使用 VS05 或更高版本编译 MTL2 时遇到问题。

那么,知道如何在 MTL4 中进行矩阵求逆吗?

更新:我想我更了解 Matt,我正在前往 this ITL path .

最佳答案

看起来您使用了 lu_factor,然后是 lu_inverse。不过,我不记得你与枢轴有什么关系。来自documentation .

是的,就像你说的,看起来他们的文档说你需要 lu.h,不知何故:

How do I invert a matrix?

The first question you should ask yourself is whether you want to really compute the inverse of a matrix or if you really want to solve a linear system. For solving a linear system of equations, it is not necessary to explicitly compute the matrix inverse. Rather, it is more efficient to compute triangular factors of the matrix and then perform forward and backward triangular solves with the factors. More about solving linear systems is given below. If you really want to invert a matrix, there is a function lu_inverse() in mtl/lu.h.

如果不出意外,可以看看lu.h on their site .

关于c++ - 矩阵模板库矩阵求逆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/337620/

相关文章:

c++ - vector 最后一个元素的迭代器

c++ - 安装 msvcr80d.dll

java - 从文件夹中排除 cpp 而不删除

c++ - 非立方区域的 Morton 曲线是 2 的幂

c - 绘制点之间的中点线

c++ - 在 native C++ 中以编程方式连接到 OpenVPN

C语言程序无法结束循环

c++ - 使用自定义分配器计算内存使用情况

c++ - 我可以以某种方式返回 std::optional 和 const-reference 到我的数据以避免复制它吗?

c++ - 标准::原子 | compare_exchange_weak 与 compare_exchange_strong