我的问题不是F = svd(A),可以先为 SVD 结构分配适当的内存,然后再做F .= svd(A)吗?
我的想法是这样的:
function main()
F = Vector{SVD}(undef,10)
# how to preallocate F?
test(F)
end
function test(F::Vector{SVD})
for i in 1:10
F .= svd(rand(3,3))
end
end
Run Code Online (Sandbox Code Playgroud) julia ×1