小编Fra*_*rio的帖子

有没有办法在 Julia 中以 O(1) 的时间交换列?

我选择 Julia 来做一些数值分析工作,并尝试实现完整的主元 LU 分解(例如,尝试获得尽可能稳定的 LU 分解)。我认为最好的方法是找到每列的最大值,然后按最大值的降序排列这些列。

有没有办法避免交换两列的每个元素,而是执行诸如更改两个引用/指针之类的操作?

linear-algebra numerical-methods julia

4
推荐指数
1
解决办法
2153
查看次数

如何在Julia中获取数组的大小?

我正在尝试运行以下代码:

function inversePoly(A::Array{Int64,1}, B::Array{Int64,1})
    n = size(A)
    retVal = A[end] / B[end]
    i = 1
    while i != n
        retVal = (retVal + 1 / B[n - i]) * A[n - i]
        i += 1
    end
    return retVal
end

inversePoly(Array(3:4), Array(4:5))
Run Code Online (Sandbox Code Playgroud)

但是,朱莉娅给我以下错误:

LoadError: MethodError: no method matching -(::Tuple{Int64}, ::Int64)
Closest candidates are:
  -(!Matched::Complex{Bool}, ::Real) at complex.jl:298
  -(!Matched::Missing, ::Number) at missing.jl:97
  -(!Matched::Base.CoreLogging.LogLevel, ::Integer) at logging.jl:107
  ...
in expression starting at /home/francisco/Julia/abc.jl:12
inversePoly(::Array{Int64,1}, ::Array{Int64,1}) at abc.jl:6
top-level scope at none:0
Run Code Online (Sandbox Code Playgroud)

第六行是

retVal …
Run Code Online (Sandbox Code Playgroud)

arrays julia

2
推荐指数
1
解决办法
300
查看次数

标签 统计

julia ×2

arrays ×1

linear-algebra ×1

numerical-methods ×1