matrix_t Derived Type

type, public :: matrix_t

General matrix type, represents the linked list implementation


Contents


Components

TypeVisibilityAttributesNameInitial
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


Type-Bound Procedures

procedure, public :: add_element

  • private subroutine add_element(this, row, column, element)

    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.

    Arguments

    TypeIntentOptionalAttributesName
    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

procedure, public :: set_label

  • private pure subroutine set_label(this, label)

    Sets the label of the current matrix.

    Arguments

    TypeIntentOptionalAttributesName
    class(matrix_t), intent(inout) :: this

    type instance

    character(len=*), intent(in) :: label

    label to set

procedure, public :: get_complex_element

  • private function get_complex_element(this, row, column) result(element)

    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 found this function returns (complex) zero.

    Arguments

    TypeIntentOptionalAttributesName
    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

    Return Value complex(kind=dp)

    the element at position (row, column) in the matrix

procedure, public :: get_total_nb_elements

  • private pure function get_total_nb_elements(this) result(total_nb_elements)

    Returns the total number of elements (nodes) across the various rows.

    Arguments

    TypeIntentOptionalAttributesName
    class(matrix_t), intent(in) :: this

    type instance

    Return Value integer

    total number of (non-zero) elements in this matrix

procedure, public :: get_label

  • private pure function get_label(this) result(label)

    Returns the current label.

    Arguments

    TypeIntentOptionalAttributesName
    class(matrix_t), intent(in) :: this

    type instance

    Return Value character

    current matrix label

procedure, public :: get_nb_diagonals

  • private subroutine get_nb_diagonals(this, ku, kl)

    Subroutine to get the number of super- and sub-diagonals in the matrix.

    Arguments

    TypeIntentOptionalAttributesName
    class(matrix_t), intent(in) :: this

    type instance

    integer, intent(out) :: ku

    number of superdiagonals

    integer, intent(out) :: kl

    number of subdiagonals

procedure, public :: copy

  • private function copy(matrix_in) result(matrix_out)

    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).

    Read more…

    Arguments

    TypeIntentOptionalAttributesName
    class(matrix_t), intent(in) :: matrix_in

    the original matrix

    Return Value type(matrix_t)

    copy from the original matrix

procedure, public :: delete_matrix

  • private pure subroutine delete_matrix(this)

    Deallocates the matrix datastructure, nullifies all corresponding pointers and deallocates the various nodes in the rows.

    Arguments

    TypeIntentOptionalAttributesName
    class(matrix_t), intent(inout) :: this