Julia中的特征值/向量并行化

问题描述

在FEM代码的许多阶段,我需要计算数千个特征值和向量。我在并行计算领域还很陌生,对于共享和分布式内存计算机,最有效的并行化方法是什么?我也开始学习Julia,因此也欢迎进一步的代码优化。

using StaticArrays,LinearAlgebra
n               = Int(10e3)
Fxx,Fzz,Fxz,Fzx = rand(n,6),rand(n,6)
function fse(Fxx,Fzx,Fzz)

n   = size(Fxx,1)
a1s = Array{Float64}(undef,n,6)
a2s = Array{Float64}(undef,6)
vx1 = Array{Float64}(undef,6)
vy1 = Array{Float64}(undef,6)
vx2 = Array{Float64}(undef,6)
vy2 = Array{Float64}(undef,6)
F   = zeros(MMatrix{2,2})
L   = zeros(MMatrix{2,2})

# -- START LOOP
@inbounds for i = 1:n
    for j = 1:6

        F[1,1]     = Fxx[i,j]
        F[1,2]     = Fxz[i,j]
        F[2,1]     = Fzx[i,2]     = Fzz[i,j]
        L          .= F * F'

        # -- Numerical solution for eigenvectors
        evect       = float(eigvecs(L))
        vx1[i,j]   = evect[1,2]
        vy1[i,j]   = evect[2,2]
        vx2[i,1]
        vy2[i,1]

        # -- Analytical solution eigenvalues for 2x2 matrix
        α           = (L[1,1] + L[2,2]) / 2
        β           = sqrt(((L[1,1] - L[2,2])^2) / 4 + L[1,2] * L[2,1])
        a1s[i,j]   = sqrt(α + β)
        a2s[i,j]   = sqrt(α - β)

    end
end

return [a1s,a2s,vx1,vx2,vy1,vy2]

end ### END fse_par ############################################################

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)