Range and direct sum decomposition

  1. Is there anyway to find range of a matrix in julia?
  2. is there any way to find direct sum decomposition to two Matrices
  1. Not sure how you want that to be represented. One way is to choose a symbolic package, define a symbolic vector b of variables and say r = A*b
  2. If I understand correctly,
directsum(A,B) = [A zeros(size(A,1), size(B,2)); zeros(size(B,1), size(A,2)) B]
1 Like

Range of a matrix is a (sub)space spanned by the columns of the matrix. Now, how do you want to characterize it? The immediate solution is really just to grab the columns of the matrix and your range is then given by an arbitrary linear combination of the columns. If you prefer orthonormal basis and want to consider just the minimal necessary set of basis vectors, then SVD is your friend:

julia> using LinearAlgebra

julia> A = [1.0 2.0 4.0
            2.0 3.0 6.0
            3.0 4.0 8.0
            4.0 5.0 10.0]
4×3 Matrix{Float64}:
 1.0  2.0   4.0
 2.0  3.0   6.0
 3.0  4.0   8.0
 4.0  5.0  10.0

julia> F = svd(A)
SVD{Float64, Float64, Matrix{Float64}}
U factor:
4×3 Matrix{Float64}:
 -0.263393  -0.794119   -0.171407
 -0.404182  -0.369644    0.616285
 -0.544971   0.0548299  -0.718349
 -0.685761   0.479304    0.273471
singular values:
3-element Vector{Float64}:
 17.310872175339917
  0.5776716446584025
  2.3860836081194186e-17
Vt factor:
3×3 Matrix{Float64}:
 -0.314814  -0.424474  -0.848948
  0.949153  -0.140789  -0.281579
  0.0       -0.894427   0.447214

julia> F.U[:,1:2]
4×2 Matrix{Float64}:
 -0.263393  -0.794119
 -0.404182  -0.369644
 -0.544971   0.0548299
 -0.685761   0.479304
4 Likes

Thanks for replying, @gustaphe @zdenek_hurak
i however have found what i was looking for here
https://jutho.github.io/TensorKit.jl/stable/lib/spaces/#TensorKit.:⊕

Hope you find it useful too

1 Like