General matrix type, represents the linked list implementation
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | matrix_dim | dimension of the matrix, number of rows |
|||
type(row_t), | public, | allocatable | :: | rows(:) | array containing the various rows |
||
character, | private, | allocatable | :: | label | label to distinguish between different matrix instances |
Adds a given element at a certain (row, column) position to the matrix datastructure. Elements that are zero are not added, sanity checks are done on the row and column indices.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(matrix_t), | intent(inout) | :: | this | type instance |
||
integer, | intent(in) | :: | row | row position of the element |
||
integer, | intent(in) | :: | column | column position of the element |
||
class(*), | intent(in) | :: | element | polymorphic variable to add to the matrix |
Returns the complex element associated with the linked-list node at position (row, column) in the matrix datastructure. Non-existing nodes correspond to zero values, so when a node at (row, column) is not foudn this function returns (complex) zero.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(matrix_t), | intent(in) | :: | this | type instance |
||
integer, | intent(in) | :: | row | row position of the needed element |
||
integer, | intent(in) | :: | column | column position of the needed element |
the element at position (row, column) in the matrix
Returns the total number of elements (nodes) across the various rows.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(matrix_t), | intent(in) | :: | this | type instance |
total number of (non-zero) elements in this matrix
Subroutine to get the number of super- and sub-diagonals in the matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(matrix_t), | intent(in) | :: | this | type instance |
||
integer, | intent(out) | :: | ku | number of superdiagonals |
||
integer, | intent(out) | :: | kl | number of subdiagonals |
Dedicated function to copy a matrix structure into a new matrix structure. The datastructure contains pointers, such that simply setting matrix1 = matrix2 may result in pointer target losses (and wrong results).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(matrix_t), | intent(in) | :: | matrix_in | the original matrix |
copy from the original matrix
Deallocates the matrix datastructure, nullifies all corresponding pointers and deallocates the various nodes in the rows.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(matrix_t), | intent(inout) | :: | this |