NTPoly
Data Types | Functions/Subroutines
sparsematrixmodule Module Reference

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)
 Internal only. Create a sparse matrix with a certain number of columns and rows. Will allocate storage for the outer values, nothing else. More...
 
subroutine, public constructsparsematrixfromfile (this, file_name)
 Create a sparse matrix by reading in a matrix market file. More...
 
pure subroutine, public constructzerosparsematrix (this, rows, columns)
 Construct a sparse matrix with zero values in it. 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. 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 extractrow (this, row_number, row_out)
 Extract a row from the matrix into the compressed vector representation. More...
 
pure subroutine, public extractcolumn (this, column_number, column_out)
 Extract a column from the matrix into the compressed vector representation. 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 composesparsematrix (mat_array, block_rows, block_columns, out_matrix)
 Create a big matrix from an array of matrices by putting them one next to another. 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 splitsparsematrix (this, block_rows, block_columns, split_array, block_size_row_in, block_size_column_in)
 Split a sparse matrix into an array of sparse matrices. More...
 
pure subroutine, public splitsparsematrixcolumns (this, num_blocks, block_sizes, split_list)
 Split a matrix into into small blocks based on the specified offsets. 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. More...
 

Detailed Description

A module for handling locally stored CSR matrices.

Function/Subroutine Documentation

◆ composesparsematrix()

pure subroutine, public sparsematrixmodule::composesparsematrix ( type(sparsematrix_t), dimension(block_columns, block_rows), intent(in)  mat_array,
integer, intent(in)  block_rows,
integer, intent(in)  block_columns,
type(sparsematrix_t), intent(inout)  out_matrix 
)

Create a big matrix from an array of matrices by putting them one next to another.

Parameters
[in]mat_array2d array of matrices to compose.
[in]block_rowsthe number of rows of the array of blocks.
[in]block_columnsthe number of columns of the array of blocks.
[out]out_matrixthe composed matrix.

◆ composesparsematrixcolumns()

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.

Parameters
[in]mat_listlist of matrices to compose.
[out]out_matrix= [Matrix 1 | Matrix 2, ...] .

◆ constructemptysparsematrix()

pure subroutine, public sparsematrixmodule::constructemptysparsematrix ( type(sparsematrix_t), intent(out)  this,
integer, intent(in)  columns,
integer, intent(in)  rows 
)

Internal only. Create a sparse matrix with a certain number of columns and rows. Will allocate storage for the outer values, nothing else.

Parameters
[out]thisthe matrix being created. It will have the outer index allocated, but nothing else.
[in]columnsnumber of matrix columns.
[in]rowsnumber of matrix rows.

◆ constructfromtripletlist()

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.

Parameters
[out]thisthe matrix being constructed
[in]triplet_lista list of triplet values. They must be sorted.
[in]rowsnumber of matrix rows
[in]columnsnumber of matrix columns

◆ constructsparsematrixfromfile()

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.

Parameters
[out]thisthe matrix being constructed.
[in]file_namename of the file.

◆ constructzerosparsematrix()

pure subroutine, public sparsematrixmodule::constructzerosparsematrix ( type(sparsematrix_t), intent(out)  this,
integer, intent(in)  rows,
integer, intent(in)  columns 
)

Construct a sparse matrix with zero values in it.

Parameters
[out]thisthe matrix being constructed
[in]rowsnumber of matrix rows
[in]columnsnumber of matrix columns

◆ copysparsematrix()

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.

Parameters
[in]matAmatrix to copy
[in,out]matB= matA

◆ destructsparsematrix()

pure subroutine, public sparsematrixmodule::destructsparsematrix ( type(sparsematrix_t), intent(inout)  this)

Explicitly destruct a sparse matrix.

Parameters
[in,out]thisthe matrix to free up

◆ extractcolumn()

pure subroutine, public sparsematrixmodule::extractcolumn ( type(sparsematrix_t), intent(in)  this,
integer, intent(in)  column_number,
type(sparsematrix_t), intent(inout)  column_out 
)

Extract a column from the matrix into the compressed vector representation.

Parameters
[in]thisthe matrix to extract from.
[in]column_numberthe row to extract
[out]column_outthe matrix representing that row

◆ extractrow()

pure subroutine, public sparsematrixmodule::extractrow ( type(sparsematrix_t), intent(in)  this,
integer, intent(in)  row_number,
type(sparsematrix_t), intent(inout)  row_out 
)

Extract a row from the matrix into the compressed vector representation.

Parameters
[in]thisthe matrix to extract from.
[in]row_numberthe row to extract
[out]row_outthe matrix representing that row

◆ getcolumns()

pure integer function, public sparsematrixmodule::getcolumns ( type(sparsematrix_t), intent(in)  this)

Get the number of columns of a matrix.

Parameters
[in]thisthe matrix.
Returns
number of columns.

◆ getrows()

pure integer function, public sparsematrixmodule::getrows ( type(sparsematrix_t), intent(in)  this)

Get the number of rows of a matrix.

Parameters
[in]thisthe matrix.
Returns
number of rows.

◆ matrixtotripletlist()

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.

Parameters
[in]thisthe matrix to construct the triplet list from.
[out]triplet_listthe triplet list we created.

◆ printsparsematrix()

subroutine, public sparsematrixmodule::printsparsematrix ( type(sparsematrix_t), intent(in)  this,
character(len=*), intent(in), optional  file_name_in 
)

Print out a sparse matrix.

Parameters
[in]thisthe matrix to be printed.
[in]file_name_inoptionally, you can pass a file to print to.

◆ splitsparsematrix()

pure subroutine, public sparsematrixmodule::splitsparsematrix ( type(sparsematrix_t), intent(in)  this,
integer, intent(in)  block_rows,
integer, intent(in)  block_columns,
type(sparsematrix_t), dimension(block_columns, block_rows), intent(inout)  split_array,
integer, dimension(block_rows), intent(in), optional  block_size_row_in,
integer, dimension(block_columns), intent(in), optional  block_size_column_in 
)

Split a sparse matrix into an array of sparse matrices.

Parameters
[in]thisthe matrix to split.
[in]block_rowsnumber of rows to split the matrix into.
[in]block_columnsnumber of columns to split the matrix into.
[out]split_arraya COLUMNxROW array for the output to go into.
[in]block_size_row_inspecifies the block size (optional)
[in]block_size_column_inspecifies the block size (optional)

◆ splitsparsematrixcolumns()

pure subroutine, public sparsematrixmodule::splitsparsematrixcolumns ( type(sparsematrix_t), intent(in)  this,
integer, intent(in)  num_blocks,
integer, dimension(num_blocks), intent(in)  block_sizes,
type(sparsematrix_t), dimension(num_blocks), intent(inout)  split_list 
)

Split a matrix into into small blocks based on the specified offsets.

Parameters
[in]thismatrix to perform this operation on.
[in]num_blocksnumber of blocks to split into
[out]block_offsetsthe offsets used for splitting.
[out]split_list1D array of blocks.

◆ transposesparsematrix()

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.

Parameters
[in]thisthe matrix to be transposed.
[out]matTthe input matrix transposed.