MatrixMarketModule Module

This module contains helpers for processing matrix market files.



Contents


Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: MAX_LINE_LENGTH = 1024

The longest line size possible according to the spec.


Enumerations

enum, bind(c)

Enumerators

enumerator:: MM_COORDINATE = 1

Sparse coordinate file.

enumerator:: MM_ARRAY = 2

Dense array file.

enumerator:: MM_REAL = 1

Real data being read in.

enumerator:: MM_INTEGER = 2

Integer data being read in.

enumerator:: MM_COMPLEX = 3

Complex numbers being read in.

enumerator:: MM_PATTERN = 4

Just a pattern of non zeros.

enumerator:: MM_GENERAL = 1

File lacks symmetry.

enumerator:: MM_SYMMETRIC = 2

File is symmetric

enumerator:: MM_SKEW_SYMMETRIC = 3

File is skew symmetric.

enumerator:: MM_HERMITIAN = 4

File is hermitian.


Interfaces

public interface WriteMMLine

  • public pure subroutine WriteMMLine_ii(outstring, row, column, add_newline_in)

    Write a single line that would correspond to a matrix market entry.

    Arguments

    Type IntentOptional Attributes Name
    character(len=MAX_LINE_LENGTH), intent(inout) :: outstring

    The final string is written to this variable.

    integer, intent(in) :: row

    The first coordinate value

    integer, intent(in) :: column

    The second coordinate value

    logical, intent(in), optional :: add_newline_in

    Whether to append a new line to the output (default = .false.)

  • public pure subroutine WriteMMLine_iif(outstring, row, column, val, add_newline_in)

    Write a single line that would correspond to a matrix market entry.

    Arguments

    Type IntentOptional Attributes Name
    character(len=MAX_LINE_LENGTH), intent(inout) :: outstring

    The final string is written to this variable.

    integer, intent(in) :: row

    The first coordinate value

    integer, intent(in) :: column

    The second coordinate value

    real(kind=NTREAL), intent(in) :: val

    The value at that coordinate

    logical, intent(in), optional :: add_newline_in

    Whether to append a new line to the output (default = .false.)

  • public pure subroutine WriteMMLine_iiff(outstring, row, column, val1, val2, add_newline_in)

    Write a single line that would correspond to a matrix market entry.

    Arguments

    Type IntentOptional Attributes Name
    character(len=MAX_LINE_LENGTH), intent(inout) :: outstring

    The final string is written to this variable.

    integer, intent(in) :: row

    The first coordinate value

    integer, intent(in) :: column

    The second coordinate value

    real(kind=NTREAL), intent(in) :: val1

    The value at that coordinate

    real(kind=NTREAL), intent(in) :: val2

    The second value at the coordinate

    logical, intent(in), optional :: add_newline_in

    Whether to append a new line to the output (default = .false.)

  • public pure subroutine WriteMMLine_f(outstring, val, add_newline_in)

    Write a single line that would correspond to a matrix market entry.

    Arguments

    Type IntentOptional Attributes Name
    character(len=MAX_LINE_LENGTH), intent(inout) :: outstring

    The final string is written to this variable.

    real(kind=NTREAL), intent(in) :: val

    The value at that coordinate

    logical, intent(in), optional :: add_newline_in

    Whether to append a new line to the output (default = .false.)

  • public pure subroutine WriteMMLine_ff(outstring, val1, val2, add_newline_in)

    Write a single line that would correspond to a matrix market entry.

    Arguments

    Type IntentOptional Attributes Name
    character(len=MAX_LINE_LENGTH), intent(inout) :: outstring

    The final string is written to this variable.

    real(kind=NTREAL), intent(in) :: val1

    The value at that coordinate

    real(kind=NTREAL), intent(in) :: val2

    The second value at that coordinate

    logical, intent(in), optional :: add_newline_in

    Whether to append a new line to the output (default = .false.)


Functions

public function ParseMMHeader(line, sparsity_type, data_type, pattern_type) result(no_error)

Parse a matrix market header.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: line

String to parse.

integer, intent(out) :: sparsity_type

If coordinate or array type.

integer, intent(out) :: data_type

If real, integer, complex, pattern.

integer, intent(out) :: pattern_type

If general, symmetric, skew_symmetric, hermitian.

Return Value logical

True if no errors.


Subroutines

public pure subroutine WriteMMSize(outstring, rows, columns, values_in)

Write the line describing the size of the matrix

Arguments

Type IntentOptional Attributes Name
character(len=MAX_LINE_LENGTH), intent(inout) :: outstring

The final string is written to this variable.

integer, intent(in) :: rows

The number of rows of the matrix

integer, intent(in) :: columns

The number of columns of the matrix

integer(kind=NTLONG), intent(in), optional :: values_in

The total number of non zero values in the matrix (for sparse format).

public pure subroutine WriteMMLine_ii(outstring, row, column, add_newline_in)

Write a single line that would correspond to a matrix market entry.

Arguments

Type IntentOptional Attributes Name
character(len=MAX_LINE_LENGTH), intent(inout) :: outstring

The final string is written to this variable.

integer, intent(in) :: row

The first coordinate value

integer, intent(in) :: column

The second coordinate value

logical, intent(in), optional :: add_newline_in

Whether to append a new line to the output (default = .false.)

public pure subroutine WriteMMLine_iif(outstring, row, column, val, add_newline_in)

Write a single line that would correspond to a matrix market entry.

Arguments

Type IntentOptional Attributes Name
character(len=MAX_LINE_LENGTH), intent(inout) :: outstring

The final string is written to this variable.

integer, intent(in) :: row

The first coordinate value

integer, intent(in) :: column

The second coordinate value

real(kind=NTREAL), intent(in) :: val

The value at that coordinate

logical, intent(in), optional :: add_newline_in

Whether to append a new line to the output (default = .false.)

public pure subroutine WriteMMLine_iiff(outstring, row, column, val1, val2, add_newline_in)

Write a single line that would correspond to a matrix market entry.

Arguments

Type IntentOptional Attributes Name
character(len=MAX_LINE_LENGTH), intent(inout) :: outstring

The final string is written to this variable.

integer, intent(in) :: row

The first coordinate value

integer, intent(in) :: column

The second coordinate value

real(kind=NTREAL), intent(in) :: val1

The value at that coordinate

real(kind=NTREAL), intent(in) :: val2

The second value at the coordinate

logical, intent(in), optional :: add_newline_in

Whether to append a new line to the output (default = .false.)

public pure subroutine WriteMMLine_f(outstring, val, add_newline_in)

Write a single line that would correspond to a matrix market entry.

Arguments

Type IntentOptional Attributes Name
character(len=MAX_LINE_LENGTH), intent(inout) :: outstring

The final string is written to this variable.

real(kind=NTREAL), intent(in) :: val

The value at that coordinate

logical, intent(in), optional :: add_newline_in

Whether to append a new line to the output (default = .false.)

public pure subroutine WriteMMLine_ff(outstring, val1, val2, add_newline_in)

Write a single line that would correspond to a matrix market entry.

Arguments

Type IntentOptional Attributes Name
character(len=MAX_LINE_LENGTH), intent(inout) :: outstring

The final string is written to this variable.

real(kind=NTREAL), intent(in) :: val1

The value at that coordinate

real(kind=NTREAL), intent(in) :: val2

The second value at that coordinate

logical, intent(in), optional :: add_newline_in

Whether to append a new line to the output (default = .false.)