Contains types and routines to handle banded matrices. We use the same conventions as explained in the LAPACK guide http://www.netlib.org/lapack/lug/node124.html.
type to represent a complex banded matrix
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | m | number of rows |
|||
integer, | public | :: | n | number of columns |
|||
integer, | public | :: | kl | number of subdiagonals |
|||
integer, | public | :: | ku | number of superdiagonals |
|||
complex(kind=dp), | public, | allocatable | :: | AB(:,:) | array containing the banded storage |
procedure, public :: get_element | |
procedure, public :: set_element | |
procedure, public :: get_total_nb_elements | |
procedure, public :: get_total_nb_nonzero_elements | |
procedure, public :: is_compatible_with | |
procedure, public :: destroy |
Constructor for a new banded matrix with a given number of rows, columns, subdiagonals and superdiagonals. Allocates and initialises the datatype.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | rows | number of rows |
||
integer, | intent(in) | :: | cols | number of columns |
||
integer, | intent(in) | :: | subdiags | number of subdiagonals |
||
integer, | intent(in) | :: | superdiags | number of superdiagonals |
banded matrix datatype
Retrieves the element at position (row, col) of the original matrix. See the LAPACK documentation, element $a_{ij}$ of the original matrix is stored at position $(ku + 1 + i - j, j)$ (with $ku$ the number of superdiagonals).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(banded_matrix_t), | intent(in) | :: | this | type instance |
||
integer, | intent(in) | :: | row | the row index of the original position |
||
integer, | intent(in) | :: | col | the column index of the original position |
the element at original position (row, col)
Returns the total number of elements inside the banded matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(banded_matrix_t), | intent(in) | :: | this | type instance |
Returns the total number of nonzero elements inside the banded matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(banded_matrix_t), | intent(in) | :: | this | type instance |
Checks if a given position (row, col) is within the banded structure, i.e. with $ku$ the number of superdiagonals and $kl$ the number of subdiagonals.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(banded_matrix_t), | intent(in) | :: | matrix | the banded matrix structure |
||
integer, | intent(in) | :: | row | row index |
||
integer, | intent(in) | :: | col | column index |
Checks if a banded matrix is compatibe with another banded matrix.
This implies that the following attributes should be equal:
- dimensions of the original matrices
- number of superdiagonals and subdiagonals
- dimensions of the banded matrices themselves
Returns .true.
if these three criteria are satisfied, .false.
otherwise.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(banded_matrix_t), | intent(in) | :: | this | type instance |
||
type(banded_matrix_t), | intent(in) | :: | other | other banded matrix |
Checks if the given matrix dimensions are valid. For now, we only accept
square matrices. Returns .true.
if rows
equals cols
, .false.
otherwise.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | rows | number of rows in the original matrix |
||
integer, | intent(in) | :: | cols | number of columns in the original matrix |
Sets the element $a_{ij}$ of the original array into the banded structure. The row and col arguments refer to the row and column indices of the element in the original array. This routine has no effect if the location falls outside of the banded structure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(banded_matrix_t), | intent(inout) | :: | this | type instance |
||
integer, | intent(in) | :: | row | row index of element |
||
integer, | intent(in) | :: | col | column index of element |
||
complex(kind=dp), | intent(in) | :: | element | value for the element at (row, col) |
Destructor, deallocates the datastructure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(banded_matrix_t), | intent(inout) | :: | this | type instance |