NTPoly
|
A module for handling locally stored CSR matrices. More...
Data Types | |
type | sparsematrix_t |
A datatype for storing a CSR matrix. More... | |
Functions/Subroutines | |
pure subroutine, public | constructemptysparsematrix (this, columns, rows) |
Create a sparse matrix with a certain number of columns and rows. Will allocate storage for the outer values. More... | |
subroutine, public | constructsparsematrixfromfile (this, file_name) |
Create a sparse matrix by reading in a matrix market file. More... | |
pure subroutine, public | constructfromtripletlist (this, triplet_list, rows, columns) |
Construct a sparse matrix from a SORTED triplet list. The triplet list must be sorted to efficiently fill in the matrix. This constructor assumes you have already sorted the triplet list. More... | |
pure subroutine, public | destructsparsematrix (this) |
Explicitly destruct a sparse matrix. This will always check if arrays are actually allocated, so you can feel free to destruct a matrix even if it has no data. More... | |
pure subroutine, public | copysparsematrix (matA, matB) |
Copy a sparse matrix in a safe way. More... | |
pure integer function, public | getrows (this) |
Get the number of rows of a matrix. More... | |
pure integer function, public | getcolumns (this) |
Get the number of columns of a matrix. More... | |
pure subroutine, public | transposesparsematrix (this, matT) |
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. More... | |
pure subroutine, public | composesparsematrixcolumns (mat_list, out_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. More... | |
pure subroutine, public | splitsparsematrixcolumns (this, num_blocks, split_list, block_offsets_out) |
Take a matrix, and split into into small blocks. More... | |
pure subroutine, public | matrixtotripletlist (this, triplet_list) |
Construct a triplet list from a matrix. More... | |
subroutine, public | printsparsematrix (this, file_name_in) |
Print out a sparse matrix. We first create a triplet list, and then call the print triplet list function. More... | |
pure logical function, public | checkifidentity (this, threshold_in) |
Check if a matrix is equal to the identity matrix. This routine is really just for testing. You can multiply a matrix and its inverse, and then call this routine to make sure multiplication is correct. More... | |
A module for handling locally stored CSR matrices.
pure logical function, public sparsematrixmodule::checkifidentity | ( | type(sparsematrix_t), intent(in) | this, |
real(ntreal), intent(in), optional | threshold_in | ||
) |
Check if a matrix is equal to the identity matrix. This routine is really just for testing. You can multiply a matrix and its inverse, and then call this routine to make sure multiplication is correct.
[in] | this | the matrix to check. |
[in] | threshold_in | for flushing values to zero. Default value is 10^-8. |
pure subroutine, public sparsematrixmodule::composesparsematrixcolumns | ( | type(sparsematrix_t), dimension(:), intent(in) | mat_list, |
type(sparsematrix_t), intent(inout) | out_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.
[in] | mat_list | list of matrices to compose. |
[out] | out_matrix | = [Matrix 1 | Matrix 2, ...] . |
pure subroutine, public sparsematrixmodule::constructemptysparsematrix | ( | type(sparsematrix_t), intent(out) | this, |
integer, intent(in) | columns, | ||
integer, intent(in) | rows | ||
) |
Create a sparse matrix with a certain number of columns and rows. Will allocate storage for the outer values.
[out] | this | the matrix being created. It will have the outer index allocated, but nothing else. |
[in] | columns | number of matrix columns. |
[in] | rows | number of matrix rows. |
pure subroutine, public sparsematrixmodule::constructfromtripletlist | ( | type(sparsematrix_t), intent(out) | this, |
type(tripletlist_t), intent(in) | triplet_list, | ||
integer, intent(in) | rows, | ||
integer, intent(in) | columns | ||
) |
Construct a sparse matrix from a SORTED triplet list. The triplet list must be sorted to efficiently fill in the matrix. This constructor assumes you have already sorted the triplet list.
[out] | this | the matrix being constructed |
[in] | triplet_list | a list of triplet values. They must be sorted. |
[in] | rows | number of matrix rows |
[in] | columns | number of matrix columns |
subroutine, public sparsematrixmodule::constructsparsematrixfromfile | ( | type(sparsematrix_t), intent(out) | this, |
character(len=*), intent(in) | file_name | ||
) |
Create a sparse matrix by reading in a matrix market file.
[out] | this | the matrix being constructed. |
[in] | file_name | name of the file. |
pure subroutine, public sparsematrixmodule::copysparsematrix | ( | type(sparsematrix_t), intent(in) | matA, |
type(sparsematrix_t), intent(inout) | matB | ||
) |
Copy a sparse matrix in a safe way.
[in] | matA | matrix to copy |
[in,out] | matB | = matA |
pure subroutine, public sparsematrixmodule::destructsparsematrix | ( | type(sparsematrix_t), intent(inout) | this | ) |
Explicitly destruct a sparse matrix. This will always check if arrays are actually allocated, so you can feel free to destruct a matrix even if it has no data.
[in,out] | this | the matrix to free up |
pure integer function, public sparsematrixmodule::getcolumns | ( | type(sparsematrix_t), intent(in) | this | ) |
Get the number of columns of a matrix.
[in] | this | the matrix. |
pure integer function, public sparsematrixmodule::getrows | ( | type(sparsematrix_t), intent(in) | this | ) |
Get the number of rows of a matrix.
[in] | this | the matrix. |
pure subroutine, public sparsematrixmodule::matrixtotripletlist | ( | type(sparsematrix_t), intent(in) | this, |
type(tripletlist_t), intent(inout) | triplet_list | ||
) |
Construct a triplet list from a matrix.
[in] | this | the matrix to construct the triplet list from. |
[out] | triplet_list | the triplet list we created. |
subroutine, public sparsematrixmodule::printsparsematrix | ( | type(sparsematrix_t), intent(in) | this, |
character(len=*), intent(in), optional | file_name_in | ||
) |
Print out a sparse matrix. We first create a triplet list, and then call the print triplet list function.
[in] | this | the matrix to be printed. |
[in] | file_name_in | optionally, you can pass a file to print to. |
pure subroutine, public sparsematrixmodule::splitsparsematrixcolumns | ( | type(sparsematrix_t), intent(in) | this, |
integer, intent(in) | num_blocks, | ||
type(sparsematrix_t), dimension(num_blocks), intent(out) | split_list, | ||
integer, dimension(num_blocks+1), intent(out), optional | block_offsets_out | ||
) |
Take a matrix, and split into into small blocks.
[in] | this | matrix to perform this operation on. |
[in] | num_blocks | number of blocks to split into. |
[out] | split_list | 1D array of blocks. |
[out] | block_offsets_out | the offsets used for splitting. |
pure subroutine, public sparsematrixmodule::transposesparsematrix | ( | type(sparsematrix_t), intent(in) | this, |
type(sparsematrix_t), intent(inout) | matT | ||
) |
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.
[in] | this | the matrix to be transposed. |
[out] | matT | the input matrix transposed. |