GetTril
This subroutine returns the lower triangle part of a matrix.
Interface
- ܀ Interface
- ️܀ Example 1
- ܀ Example 2
- ↢
MODULE PURE SUBROUTINE GetTril(A, diagNo, lu)
INTEGER(Int8| Int16 | Int32 | Int64) | REAL(Real32| Real64), INTENT(IN) :: A(:, :)
INTEGER(I4B), OPTIONAL, INTENT(IN) :: diagNo
!! diagonal number, default = 0
INTEGER(INT64), INTENT(OUT) :: lu(SIZE(A, 1), SIZE(A, 2))
END SUBROUTINE GetTril
This example shows the use of GetTril.
program main
use easifemBase
implicit none
Testing for Square matrix
REAL( Real32 ) :: A( 4, 4 ), lu(4, 4)
CALL RANDOM_NUMBER(A); A = A*10
CALl Display(MdEncode(A), "A = " // CHAR_LF // CHAR_LF)
See results
A =
0.86636 | 3.7301 | 4.4509 | 7.4084 |
5.9178 | 6.2964 | 1.2734 | 6.8327 |
9.3275 | 1.5065 | 4.9179 | 7.6162 |
4.4428 | 5.1334 | 8.7562 | 0.1652 |
CALL GetTril(A=A, diagNo=0, lu=lu)
CALL Display(MdEncode(lu), "diagNo=0, = " // CHAR_LF // CHAR_LF )
See results
diagNo=0, =
0.86636 | 0 | 0 | 0 |
5.9178 | 6.2964 | 0 | 0 |
9.3275 | 1.5065 | 4.9179 | 0 |
4.4428 | 5.1334 | 8.7562 | 0.1652 |
CALL GetTril(A=A, diagNo=1, lu=lu)
CALL Display(MdEncode(lu), "diagNo=1, = " // CHAR_LF // CHAR_LF)
See results
diagNo=1, =
0.86636 | 3.7301 | 0 | 0 |
5.9178 | 6.2964 | 1.2734 | 0 |
9.3275 | 1.5065 | 4.9179 | 7.6162 |
4.4428 | 5.1334 | 8.7562 | 0.1652 |
CALL GetTril(A=A, diagNo=2, lu=lu)
CALL Display(MdEncode(lu), "diagNo=2, = " // CHAR_LF // CHAR_LF )
See results
diagNo=2, =
0.86636 | 3.7301 | 4.4509 | 0 |
5.9178 | 6.2964 | 1.2734 | 6.8327 |
9.3275 | 1.5065 | 4.9179 | 7.6162 |
4.4428 | 5.1334 | 8.7562 | 0.1652 |
end program main
This example shows the use of GetTril.
program main
use easifemBase
implicit none
Testing for Square matrix Let's get the upper triangular form above Subdiagonals.
REAL( Real32 ) :: A( 4, 4 ), lu(4,4)
CALL RANDOM_NUMBER(A); A = A*10
CALl Display(MdEncode(A), "A = " // CHAR_LF // CHAR_LF)
CALL GetTril(A=A,diagNo=-1, lu=lu)
CALL Display(MdEncode(lu), "diagNo=-1, = " // CHAR_LF // CHAR_LF)
CALL GetTril(A=A,diagNo=-2, lu=lu)
CALL Display(MdEncode(lu), "diagNo=-2, = " // CHAR_LF // CHAR_LF )
See results
A =
3.4843 | 0.21881 | 7.0136 | 8.6618 |
1.1204 | 4.0021 | 8.4773 | 3.9924 |
2.6185 | 8.0988 | 6.4968 | 2.7172 |
5.5955 | 2.0122 | 7.5929 | 4.431 |
diagNo=-1, =
0 | 0 | 0 | 0 |
1.1204 | 0 | 0 | 0 |
2.6185 | 8.0988 | 0 | 0 |
5.5955 | 2.0122 | 7.5929 | 0 |
diagNo=-2, =
0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 |
2.6185 | 0 | 0 | 0 |
5.5955 | 2.0122 | 0 | 0 |
end program main