A module for handling locally stored CSR matrices.
Create a sparse matrix with a certain number of columns and rows. Will allocate storage for the outer values, nothing else unless you set zero_in to true.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | rows | The number of matrix rows. |
||
integer, | intent(in) | :: | columns | The number of matrix columns. |
||
logical, | intent(in), | optional | :: | zero_in | Whether to set the matrix to zero. |
The matrix to construct.
Create a sparse matrix by reading in a matrix market file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | file_name | Name of the file. |
The matrix being constructed.
Construct a sparse matrix from a \b SORTED triplet list. The triplet list must be sorted to efficiently fill in the matrix. This constructor assumes \b you have already sorted the triplet list.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(TripletList_r), | intent(in) | :: | triplet_list | A list of triplet values. They must be sorted. |
||
integer, | intent(in) | :: | rows | Number of matrix rows |
||
integer, | intent(in) | :: | columns | Number of matrix columns |
The matrix being constructed
Create a sparse matrix with a certain number of columns and rows. Will allocate storage for the outer values, nothing else unless you set zero_in to true.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | rows | The number of matrix rows. |
||
integer, | intent(in) | :: | columns | The number of matrix columns. |
||
logical, | intent(in), | optional | :: | zero_in | Whether to set the matrix to zero. |
The matrix to construct.
Create a sparse matrix by reading in a matrix market file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | file_name | Name of the file. |
The matrix being constructed.
Construct a sparse matrix from a \b SORTED triplet list. The triplet list must be sorted to efficiently fill in the matrix. This constructor assumes \b you have already sorted the triplet list.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(TripletList_c), | intent(in) | :: | triplet_list | A list of triplet values. They must be sorted. |
||
integer, | intent(in) | :: | rows | Number of matrix rows |
||
integer, | intent(in) | :: | columns | Number of matrix columns |
The matrix being constructed
A subroutine type wrapper for the constructor.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(inout) | :: | this | The matrix to construct. |
||
integer, | intent(in) | :: | rows | The number of matrix rows. |
||
integer, | intent(in) | :: | columns | The number of matrix columns. |
||
logical, | intent(in), | optional | :: | zero_in | Whether to set the matrix to zero. |
A subroutine type wrapper for the constructor.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(inout) | :: | this | The matrix to construct. |
||
integer, | intent(in) | :: | rows | The number of matrix rows. |
||
integer, | intent(in) | :: | columns | The number of matrix columns. |
||
logical, | intent(in), | optional | :: | zero_in | Whether to set the matrix to zero. |
Subroutine wrapper for the construct from file function.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(inout) | :: | this | The matrix being constructed. |
||
character(len=*), | intent(in) | :: | file_name | Name of the file. |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(inout) | :: | this | The matrix being constructed. |
||
character(len=*), | intent(in) | :: | file_name | Name of the file. |
A subroutine wrapper for the triplet list based constructor.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(inout) | :: | this | The matrix being constructed |
||
type(TripletList_r), | intent(in) | :: | triplet_list | A list of triplet values. They must be sorted. |
||
integer, | intent(in) | :: | rows | Number of matrix rows |
||
integer, | intent(in) | :: | columns | Number of matrix columns |
A subroutine wrapper for the triplet list based constructor.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(inout) | :: | this | The matrix being constructed |
||
type(TripletList_c), | intent(in) | :: | triplet_list | A list of triplet values. They must be sorted. |
||
integer, | intent(in) | :: | rows | Number of matrix rows |
||
integer, | intent(in) | :: | columns | Number of matrix columns |
Explicitly destruct a sparse matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(inout) | :: | this | The matrix to free up. |
Explicitly destruct a sparse matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(inout) | :: | this | The matrix to free up. |
Copy a sparse matrix in a safe way.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in) | :: | matA | Matrix to copy |
||
type(Matrix_lsr), | intent(inout) | :: | matB | matB = matA |
Copy a sparse matrix in a safe way.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in) | :: | matA | Matrix to copy |
||
type(Matrix_lsc), | intent(inout) | :: | matB | matB = matA |
Get the number of rows of a matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in) | :: | this | The matrix. |
The number of rows.
Get the number of rows of a matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in) | :: | this | The matrix. |
The number of rows.
Get the number of columns of a matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in) | :: | this |
The number of columns.
Get the number of columns of a matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in) | :: | this |
The number of columns.
Extract a row from the matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in) | :: | this | The matrix to extract from. |
||
integer, | intent(in) | :: | row_number | The row to extract. |
||
type(Matrix_lsr), | intent(inout) | :: | row_out | The matrix representing that row. |
Extract a row from the matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in) | :: | this | The matrix to extract from. |
||
integer, | intent(in) | :: | row_number | The row to extract. |
||
type(Matrix_lsc), | intent(inout) | :: | row_out | The matrix representing that row. |
Extract a column from the matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in) | :: | this | The matrix to extract from. |
||
integer, | intent(in) | :: | column_number | The column to extract. |
||
type(Matrix_lsr), | intent(inout) | :: | column_out | The column representing that row. |
Extract a column from the matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in) | :: | this | The matrix to extract from. |
||
integer, | intent(in) | :: | column_number | The column to extract. |
||
type(Matrix_lsc), | intent(inout) | :: | column_out | The column representing that row. |
Split a sparse matrix into an array of sparse matrices.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in) | :: | this | The matrix to split. |
||
integer, | intent(in) | :: | block_rows | Number of rows to split the matrix into. |
||
integer, | intent(in) | :: | block_columns | Number of columns to split the matrix into. |
||
type(Matrix_lsr), | intent(inout), | DIMENSION(:,:) | :: | split_array | A COLUMNxROW array for the output to go into. |
|
integer, | intent(in), | optional | DIMENSION(:) | :: | block_size_row_in | Specifies the size of the rows. |
integer, | intent(in), | optional | DIMENSION(:) | :: | block_size_column_in | Specifies the size of the columns. |
Split a sparse matrix into an array of sparse matrices.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in) | :: | this | The matrix to split. |
||
integer, | intent(in) | :: | block_rows | Number of rows to split the matrix into. |
||
integer, | intent(in) | :: | block_columns | Number of columns to split the matrix into. |
||
type(Matrix_lsc), | intent(inout), | DIMENSION(:,:) | :: | split_array | A COLUMNxROW array for the output to go into. |
|
integer, | intent(in), | optional | DIMENSION(:) | :: | block_size_row_in | Specifies the size of the rows. |
integer, | intent(in), | optional | DIMENSION(:) | :: | block_size_column_in | Specifies the size of the columns. |
Split a matrix into into small blocks based on the specified offsets.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in) | :: | this | This matrix to perform this operation on. |
||
integer, | intent(in) | :: | num_blocks | Number of blocks to split into. |
||
integer, | intent(in), | DIMENSION(num_blocks) | :: | block_sizes | The sizes used for splitting. |
|
type(Matrix_lsr), | intent(inout), | DIMENSION(num_blocks) | :: | split_list | 1D array of blocks. |
Split a matrix into into small blocks based on the specified offsets.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in) | :: | this | This matrix to perform this operation on. |
||
integer, | intent(in) | :: | num_blocks | Number of blocks to split into. |
||
integer, | intent(in), | DIMENSION(num_blocks) | :: | block_sizes | The sizes used for splitting. |
|
type(Matrix_lsc), | intent(inout), | DIMENSION(num_blocks) | :: | split_list | 1D array of blocks. |
Create a big matrix from an array of matrices by putting them one next to another.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in), | DIMENSION(block_rows,block_columns) | :: | mat_array | 2d array of matrices to compose. |
|
integer, | intent(in) | :: | block_rows | The number of rows of the array of blocks. |
||
integer, | intent(in) | :: | block_columns | The number of columns of the array of blocks. |
||
type(Matrix_lsr), | intent(inout) | :: | out_matrix | The composed matrix. |
Create a big matrix from an array of matrices by putting them one next to another.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in), | DIMENSION(block_rows,block_columns) | :: | mat_array | 2d array of matrices to compose. |
|
integer, | intent(in) | :: | block_rows | The number of rows of the array of blocks. |
||
integer, | intent(in) | :: | block_columns | The number of columns of the array of blocks. |
||
type(Matrix_lsc), | intent(inout) | :: | out_matrix | The composed matrix. |
Create a big Matrix C = [Matrix 1 | Matrix 1, ...] where the columns of the first matrix are followed by the columns of the matrices in the list.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in), | DIMENSION(:) | :: | mat_list | A list of matrices to compose. |
|
type(Matrix_lsr), | intent(inout) | :: | out_matrix | out_matrix = [Matrix 1 | Matrix 2, ...]. |
Create a big Matrix C = [Matrix 1 | Matrix 1, ...] where the columns of the first matrix are followed by the columns of the matrices in the list.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in), | DIMENSION(:) | :: | mat_list | A list of matrices to compose. |
|
type(Matrix_lsc), | intent(inout) | :: | out_matrix | out_matrix = [Matrix 1 | Matrix 2, ...]. |
Transpose a sparse matrix and return it in a separate matrix. The current implementation has you go from matrix to triplet list, triplet list to transposed triplet list. The triplet list must then be sorted and then the return matrix is constructed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in) | :: | this | The matrix to be transposed. |
||
type(Matrix_lsr), | intent(inout) | :: | matT | The input matrix transposed. |
Transpose a sparse matrix and return it in a separate matrix. The current implementation has you go from matrix to triplet list, triplet list to transposed triplet list. The triplet list must then be sorted and then the return matrix is constructed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in) | :: | this | The matrix to be transposed. |
||
type(Matrix_lsc), | intent(inout) | :: | matT | The input matrix transposed. |
Every value in the matrix is changed into its complex conjugate.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(inout) | :: | this | The matrix to compute the complex conjugate of. |
Print out a sparse matrix to the console.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in) | :: | this | The matrix to be printed. |
||
character(len=*), | intent(in), | optional | :: | file_name_in | Optionally you can pass a file to print to. |
Print out a sparse matrix to the console.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in) | :: | this | The matrix to be printed. |
||
character(len=*), | intent(in), | optional | :: | file_name_in | Optionally you can pass a file to print to. |
Construct a triplet list from a matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in) | :: | this | The matrix to construct the triplet list from. |
||
type(TripletList_r), | intent(inout) | :: | triplet_list | The triplet list we created. |
Construct a triplet list from a matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in) | :: | this | The matrix to construct the triplet list from. |
||
type(TripletList_c), | intent(inout) | :: | triplet_list | The triplet list we created. |
Convert a complex matrix to a real matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in) | :: | cin | The starting matrix. |
||
type(Matrix_lsr), | intent(inout) | :: | rout | Real valued matrix. |
Convert a real matrix to a complex matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in) | :: | rin | The starting matrix. |
||
type(Matrix_lsc), | intent(inout) | :: | cout | The complex valued matrix. |
A datatype for storing a local, real CSR matrix.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | DIMENSION(:), ALLOCATABLE | :: | outer_index | Outer indices |
||
integer, | public, | DIMENSION(:), ALLOCATABLE | :: | inner_index | Inner indices |
||
real(kind=NTREAL), | public, | DIMENSION(:), ALLOCATABLE | :: | values | Values |
||
integer, | public | :: | rows | Matrix dimension: rows |
|||
integer, | public | :: | columns | Matrix dimension: columns |
private pure function ConstructEmptyMatrix_lsr(rows, columns, zero_in) | Create a sparse matrix with a certain number of columns and rows. Will allocate storage for the outer values, nothing else unless you set zero_in to true. |
private function ConstructMatrixFromFile_lsr(file_name) | Create a sparse matrix by reading in a matrix market file. |
private pure function ConstructMatrixFromTripletList_lsr(triplet_list, rows, columns) | Construct a sparse matrix from a \b SORTED triplet list. The triplet list must be sorted to efficiently fill in the matrix. This constructor assumes \b you have already sorted the triplet list. |
A datatype for storing a local, complex CSR matrix.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | DIMENSION(:), ALLOCATABLE | :: | outer_index | Outer indices |
||
integer, | public, | DIMENSION(:), ALLOCATABLE | :: | inner_index | Inner indices |
||
complex(kind=NTCOMPLEX), | public, | DIMENSION(:), ALLOCATABLE | :: | values | Values |
||
integer, | public | :: | rows | Matrix dimension: rows |
|||
integer, | public | :: | columns | Matrix dimension: columns |
private pure function ConstructEmptyMatrix_lsc(rows, columns, zero_in) | Create a sparse matrix with a certain number of columns and rows. Will allocate storage for the outer values, nothing else unless you set zero_in to true. |
private function ConstructMatrixFromFile_lsc(file_name) | Create a sparse matrix by reading in a matrix market file. |
private pure function ConstructMatrixFromTripletList_lsc(triplet_list, rows, columns) | Construct a sparse matrix from a \b SORTED triplet list. The triplet list must be sorted to efficiently fill in the matrix. This constructor assumes \b you have already sorted the triplet list. |