Tridiagonal
.. Tridiagonal(dl, d, du)
Construct a tridiagonal matrix from the lower diagonal, diagonal, and upper diagonal, respectively. The result is of type ``Tridiagonal`` and provides efficient specialized linear solvers, but may be converted into a regular matrix with :func:`full`.
Examples
In the Julia programming language, the Tridiagonal
function is used to construct a tridiagonal matrix from the lower diagonal (dl
), diagonal (d
), and upper diagonal (du
). The resulting object is of type Tridiagonal
and provides efficient specialized linear solvers. However, it can be converted into a regular matrix using the full
function.
Here are some examples of using the Tridiagonal
function:
-
Create a tridiagonal matrix:
julia> dl = [1, 2, 3, 4]; julia> d = [5, 6, 7, 8]; julia> du = [9, 10, 11, 12]; julia> tridiag = Tridiagonal(dl, d, du) 4×4 Tridiagonal{Int64,Array{Int64,1}}: 5 9 ⋅ ⋅ 1 6 10 ⋅ ⋅ 2 7 11 ⋅ ⋅ 3 8
This example creates a 4x4 tridiagonal matrix with the provided lower diagonal, diagonal, and upper diagonal arrays.
- Convert
Tridiagonal
to a full matrix:julia> full_matrix = full(tridiag) 4×4 Array{Int64,2}: 5 9 0 0 1 6 10 0 0 2 7 11 0 0 3 8
The
full
function converts theTridiagonal
object to a regular matrix.
Please note that the Tridiagonal
function is commonly used in numerical algorithms involving tridiagonal matrices, such as solving systems of linear equations efficiently.
See Also
Ac_ldiv_B, Ac_ldiv_Bc, Ac_mul_B, Ac_mul_Bc, Ac_rdiv_B, Ac_rdiv_Bc, At_ldiv_B, At_ldiv_Bt, At_mul_B, At_mul_Bt, At_rdiv_B, At_rdiv_Bt, A_ldiv_Bc, A_ldiv_Bt, A_mul_B!, A_mul_Bc, A_mul_Bt, A_rdiv_Bc, A_rdiv_Bt, Bidiagonal, cond, conv2, det, diag, diagind, diagm, diff, eig, eigvals, eigvecs, expm, eye, full, inv, isdiag, ishermitian, isposdef, isposdef!, issym, istril, istriu, logabsdet, logdet, lyap, norm, qrfact, rank, repmat, rot180, rotl90, rotr90, sortrows, sqrtm, SymTridiagonal, trace, Tridiagonal, tril, tril!, triu, triu!, writedlm,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.