How to use the backslash operator in Julia?

I'm currently trying to invert huge matrices of the order of 1 million to 1 million, and I decided that the Backslash operator would be useful in doing so. Any idea on how this is implemented ?. I have not found specific examples, so any help is greatly appreciated.

+4
source share
1 answer

Any idea on how this is implemented?

This is a multi-algorithm. This shows how to use it:

julia> A = rand(10,10)
10×10 Array{Float64,2}:
 0.330453  0.294142  0.682869  0.9914270.533443  0.876566   0.157157
 0.666233  0.47974   0.172657  0.427015      0.501511  0.0978822  0.634164
 0.829653  0.380123  0.589555  0.480963      0.606704  0.642441   0.159564
 0.709197  0.570496  0.484826  0.17325       0.699379  0.0281233  0.66744
 0.478663  0.87298   0.488389  0.188844      0.38193   0.641309   0.448757
 0.471705  0.804767  0.420039  0.05287290.658368  0.911007   0.705696
 0.679734  0.542958  0.22658   0.977581      0.197043  0.717683   0.21933
 0.771544  0.326557  0.863982  0.641557      0.969889  0.382148   0.508773
 0.932684  0.531116  0.838293  0.031451      0.242338  0.663352   0.784813
 0.283031  0.754613  0.938358  0.0408097     0.609105  0.325545   0.671151

julia> b = rand(10)
10-element Array{Float64,1}:
 0.0795157
 0.219318
 0.965155
 0.896807
 0.701626
 0.741823
 0.954437
 0.573683
 0.493615
 0.0821557


julia> A\b
10-element Array{Float64,1}:
  1.47909
  2.39816
 -0.15789
  0.144003
 -1.10083
 -0.273698
 -0.775122
  0.590762
 -0.0266894
 -2.36216

You can use @whichto find out how it is defined:

julia> @which A\b
\(A::AbstractArray{T,2} where T, B::Union{AbstractArray{T,1}, AbstractArray{T,2}} where T) in Base.LinAlg at linalg\generic.jl:805

: https://github.com/JuliaLang/julia/blob/master/base/linalg/generic.jl#L827 ( - ). , , , . istril : https://github.com/JuliaLang/julia/blob/master/base/linalg/generic.jl#L987 .. , , \. , \ ( \ BTW ), " " , .

, .

, \ . , . . inv , LU- ( Julia lufact). pinv psudo- , , factorize + .

. IterativeSolvers.jl

+8

Source: https://habr.com/ru/post/1682230/


All Articles