问题描述
有任何库或自由可用的代码,它将计算小( 6x6
)的双精度矩阵的行列式?
Is there any library or freely available code which will calculate the determinant of a small (6x6
), double precision matrix entirely on a GPU?
推荐答案
这里是计划,你需要缓冲100个这些小矩阵,并启动内核一次计算行列式
Here is the plan, you will need to buffer 100s of these tiny matrices and launch the kernel once to compute the determinant for all of them at once.
我不会写实际的代码,但这应该是有帮助的。
I am not going to write actual code, but this should be helpful.
1)Launch#blocks =#matrices。每个块计算每个矩阵的行列式。
1) Launch # blocks = # matrices. Each block calculates determinant of each matrix.
2)det(A)= det(A11 * A22-A21 * A12);其中A是6x6,A11,A12,A21,A22是A的3×3子矩阵。
2) det(A) = det(A11 * A22 - A21 * A12); where A is 6x6, A11, A12, A21, A22 are 3x3 sub matrices of A.
3)写一个设备乘以3x3矩阵
3) Write a device function that does matrix multiply for 3x3 matrices
4)3x3矩阵的det很容易计算:。
4) det of a 3x3 matrix is simple to calculate: use the formula from here.
EDIT :显然如果A21 * A12 == A12 * A21
EDIT: Apparently (2) only works if A21 * A12 == A12 * A21
另一种选择是下列
1)
2)乘以U的对角线元素得到行列式。
2) Multiply the diagonal elements of U to get determinant.
这篇关于CUDA的决定因素计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!