Hello,
Is there an optimized way to inverse a triangular matrix? I searched with Google, no luck.
Hello,
Is there an optimized way to inverse a triangular matrix? I searched with Google, no luck.
julia does provide specialized types UpperTriangular
, UnitUpperTriangular
, LowerTriangular
, and UnitLowerTriangular
. In the documentation it is stated that there are optimized functions for inv
and det
.
https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LAPACK-functions
This is a small example of how this should work:
using LinearAlgebra
A = [1.0 2.0 3.0; 0.0 5.0 6.0; 0.0 0.0 9.0]
3×3 Array{Float64,2}:
1.0 2.0 3.0
0.0 5.0 6.0
0.0 0.0 9.0
UTA = UpperTriangular(A)
3×3 UpperTriangular{Float64,Array{Float64,2}}:
1.0 2.0 3.0
⋅ 5.0 6.0
⋅ ⋅ 9.0
inv(UTA)
3×3 UpperTriangular{Float64,Array{Float64,2}}:
1.0 -0.4 -0.0666667
⋅ 0.2 -0.133333
⋅ ⋅ 0.111111
Ah nice, thanks!