Julia 的反斜杠 (\) 运算符对两个矩阵有何作用?

What does Julia's backslash (\) operator do on two matrices?

在矩阵的上下文中,如果我们有 A\B 正在对 AB 执行什么数学运算。文档似乎说它是除法,但我认为除法是对矩阵的无效操作。

关于线性代数的 Julia 文档有解释 here。 "For input matrices A and B, the result X is such that A*X == B".

在方阵的上下文中 AA\B returns inverse(A) * B.

您可以使用@which(或@edit

找出调用了哪个方法
A = randn(10,2)
b = randn(10)
@which A\b

导致实施

function (\)(A::AbstractMatrix, B::AbstractVecOrMat)
    require_one_based_indexing(A, B)
    m, n = size(A)
    if m == n
        if istril(A)
            if istriu(A)
                return Diagonal(A) \ B
            else
                return LowerTriangular(A) \ B
            end
        end
        if istriu(A)
            return UpperTriangular(A) \ B
        end
        return lu(A) \ B
    end
    return qr(A,Val(true)) \ B
end

你在哪里可以看到使用什么方法取决于矩阵的结构。在没有任何有用结构的情况下,执行 QR 因式分解,使用它求解线性系统。