Search code examples
matrixjulialinear-algebramatrix-decomposition

Matrix decomposition in Julia


i have a big grid with a matrix(3x3) associated at each point. I want a perform a symmetric and skew-symmetric decomposition. I know that the algorithm is

𝐴=0.5(𝐴+𝐴T)+0.5(𝐴−𝐴T)

I was checking the linear algebra library in Julia but i cant find this decomposition( i found Qr,LU,SDV,...)

It is available in Julia ( or from an external source) or i have to write it?

Thank you in advance

I want a decomposition in symmetric and anti symmetric part of a matrix. i checked the LinearAlgebra Library from Julia


Solution

  • A straightforward decomposition can be done like this

    using StaticArrays
    A = randn(SMatrix{3,3,Float64}, 4, 5)  # create initial data
    Symm = 0.5 .* (A .+ adjoint.(A))
    SkewSymm = A .- Symm  # or   0.5 .* (A .- adjoint.(A))
    

    I'm using StaticArrays for the 3x3 inner matrices, since this is much more efficient than using regular Matrix.