This interface provides different methods to construct a Diagonal
matrix. Only the diagonal elements of are being stored, i.e.
Diagonal matrix filled with zeros: integer, parameter :: n = 100
type(Diagonal) :: A
A = Diagonal(n)
Diagonal matrix from a vector. integer, parameter :: n = 100
real(dp), allocatable :: dv(:)
type(Diagonal) :: A
integer :: i
dv = [(i, i=1, n)]; A = Diagonal(dv)
Diagonal matrix with constant diagonal element. integer, parameter :: n = 100
real(dp), parameter :: d = 2.0_dp
type(Diagonal) :: A
A = Diagonal(d, n)
Diagonal matrix from a standard rank-2 array. integer, parameter :: n = 100
real(dp) :: B(n, n)
type(Diagonal) :: A
call random_number(B); A = Diagonal(B)
Note
Only double precision is currently supported for this matrix type.
Utility function to construct a Diagonal matrix from a rank-1
array.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | dv(:) |
Diagonal elements of the matrix. |
Corresponding diagonal matrix.
Utility function to construct a Diagonal matrix with constant
diagonal element.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | d |
Constant diagonal element of the matrix. |
||
| integer(kind=ilp), | intent(in) | :: | n |
Dimension of the matrix. |
Corresponding diagonal matrix.
Utility function to construct a Diagonal matrix from a rank-2
array. The resulting matrix is constructed from the diagonal
element of the input matrix, even if the latter is not diagonal.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | A(:,:) |
Dense matrix from which to construct the
|
Corresponding diagonal matrix.
Utility function to construct a Diagonal matrix filled with
zeros.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=ilp), | intent(in) | :: | n |
Dimension of the matrix. |
Corresponding diagonal matrix.