# CUR in LowRankApprox

I installed the LowRankApprox package and I want to use the Cur decomposition. I read part of the documentation on GitHub, but I still don’t understand how to use it. For example, given a matrix A = rand(5,5), and I want an approximation by a rank-3 matrix, how do I obtain the matrix U and how do I obtain the decomposition using the package?

I think this is what you want:

``````julia> A = rand(5,5)
5×5 Matrix{Float64}:
0.486094   0.75991    0.621441   0.539697  0.575809
0.0490788  0.705689   0.560474   0.87127   0.514848
0.357313   0.722965   0.815362   0.805765  0.912823
0.524595   0.0300627  0.457595   0.654335  0.13646
0.105278   0.545006   0.0349351  0.73656   0.260524

julia> U = curfact(A, rank=3);

julia> F = CUR(A, U);

julia> F[:C] * F[:U] * F[:R]
5×5 Matrix{Float64}:
0.11283   0.75991    0.621441   0.539697  0.89334
0.299764  0.705689   0.560474   0.87127   0.707704
0.357313  0.722965   0.815362   0.805765  0.912823
0.524595  0.0300627  0.457595   0.654335  0.13646
0.105278  0.545006   0.0349351  0.73656   0.260524

julia> Matrix(F[:U])
3×3 Matrix{Float64}:
-0.828474   1.39819    1.02187
1.11581    0.311455  -1.49733
1.04814   -1.90959    0.549796
``````