逆迭代期间求解线性方程
我正在使用 OpenCL 计算矩阵的特征向量。 AMD 有一个特征值计算示例,所以我决定使用逆迭代得到特征向量。
我遵循此处描述的算法,我注意到按顺序要求解步骤 4,我需要求解线性方程组(或计算矩阵的逆)。
使用 OpenCL 在 GPU 上执行此操作的最佳方法是什么?有没有我应该研究的示例/参考文献?
编辑:对不起,我应该提到我的矩阵是对称三对角的。从我读到的内容来看,这可能很重要,并且可能会大大简化整个过程
I am using OpenCL to calculate the eigenvectors of a matrix. AMD has an example of eigenvalue calculation so I decided to use inverse iteration to get the eigenvectors.
I was following the algorithm described here and I noticed that in order to solve step 4 I need to solve a system of linear equations (or calculate the inverse of a matrix).
What is the best way to do this on a GPU using OpenCL? Are there any examples/references that I should look into?
EDIT: I'm sorry, I should have mentioned that my matrix is symmetric tridiagonal. From what I have been reading this could be important and maybe simplifies the whole process a lot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
矩阵是三对角的事实非常重要 - 这将问题的复杂性从 O(N^3) 降低到 O(N)。您可能可以从它也是对称的事实中获得一些加速,但这不会那么引人注目。
求解三对角系统的方法在这里:http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm。
另请注意,您不需要存储矩阵的所有 N^2 个元素,因为几乎所有元素都为零。您只需要一个长度为 N 的向量(对于对角线)和两个长度为 N-1 的向量作为下对角线和上对角线。由于矩阵是对称的,因此下对角线和上对角线是相同的。
希望这有帮助...
The fact that the matrix is tridiagonal is VERY important - that reduces the complexity of the problem from O(N^3) to O(N). You can probably get some speedup from the fact that it's symmetric too, but that won't be as dramatic.
The method for solving a tridiagonal system is here: http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm.
Also note that you don't need to store all N^2 elements of the matrix, since almost all of them will be zeroes. You just need one vector of length N (for the diagonal) and two of length N-1 for the sub- and superdiagonals. And since your matrix is symmetric, the sub- and superdiagonals are the same.
Hope that's helpful...
我建议使用LU分解。
这是 示例。
它是用 CUDA 编写的,但我认为,用 OpenCL 重写它并不难。
I suggest using LU decomposition.
Here's example.
It's written in CUDA, but I think, it's not so hard to rewrite it in OpenCL.