SymTridiagonal

``````..  SymTridiagonal(d, du)

Construct a real symmetric tridiagonal matrix from the diagonal and upper diagonal, respectively. The result is of type ``SymTridiagonal`` and provides efficient specialized eigensolvers, but may be converted into a regular matrix with :func:`full`.``````

Examples

In the Julia programming language, the function `SymTridiagonal(d, du)` is used to construct a real symmetric tridiagonal matrix from the diagonal and upper diagonal elements. The resulting matrix is of type `SymTridiagonal` and provides efficient specialized eigensolvers. However, it can also be converted into a regular matrix using the `full` function.

``````julia> d = [1.0, 2.0, 3.0, 4.0];
julia> du = [2.0, 3.0, 4.0];
julia> matrix = SymTridiagonal(d, du)
4×4 SymTridiagonal{Float64,Array{Float64,1}}:
1.0  2.0   ⋅    ⋅
2.0  2.0  3.0   ⋅
⋅   3.0  3.0  4.0
⋅    ⋅   4.0  4.0``````

In this example, a symmetric tridiagonal matrix is created using the diagonal elements `[1.0, 2.0, 3.0, 4.0]` and the upper diagonal elements `[2.0, 3.0, 4.0]`. The resulting `SymTridiagonal` matrix `matrix` is displayed.

To convert the `SymTridiagonal` matrix into a regular matrix, you can use the `full` function:

``````julia> full_matrix = full(matrix)
4×4 Array{Float64,2}:
1.0  2.0   0.0  0.0
2.0  2.0  3.0   0.0
0.0  3.0  3.0  4.0
0.0  0.0  4.0  4.0``````

The `full` function converts the `SymTridiagonal` matrix `matrix` into a regular matrix `full_matrix` of type `Array{Float64,2}`.

Note: The `SymTridiagonal` function is typically used when working with large symmetric tridiagonal matrices where the structure can be exploited for efficient computations.