This module allows one to convert a sparse matrix to a dense matrix. It also
Construct an empty dense matrix with a set number of rows and columns
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | rows | Rows of the matrix |
||
integer, | intent(in) | :: | columns | Columns of the matrix. |
The matrix to construct.
Construct an empty dense matrix with a set number of rows and columns
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | rows | Rows of the matrix |
||
integer, | intent(in) | :: | columns | Columns of the matrix. |
The matrix to construct.
A subroutine wrapper for the empty constructor.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldr), | intent(inout) | :: | this | The matrix to construct |
||
integer, | intent(in) | :: | rows | Rows of the matrix |
||
integer, | intent(in) | :: | columns | Columns of the matrix |
A subroutine style wrapper for the constructor.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldc), | intent(inout) | :: | this | The matrix to construct. |
||
integer, | intent(in) | :: | rows | The number of rows of the matrix. |
||
integer, | intent(in) | :: | columns | The number of columns o the matrix. |
A function that converts a sparse matrix to a dense matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsr), | intent(in) | :: | sparse_matrix | The sparse matrix to convert. |
||
type(Matrix_ldr), | intent(inout) | :: | dense_matrix | Output. Must be preallocated. |
A function that converts a sparse matrix to a dense matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_lsc), | intent(in) | :: | sparse_matrix | The sparse matrix to convert. |
||
type(Matrix_ldc), | intent(inout) | :: | dense_matrix | Dense matrix output. Must be preallocated. |
A function that converts a dense matrix to a sparse matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldr), | intent(in) | :: | dense_matrix | Matrix to convert. |
||
type(Matrix_lsr), | intent(inout) | :: | sparse_matrix | Output matrix. |
||
real(kind=NTREAL), | intent(in), | optional | :: | threshold_in | Value for pruning values to zero. |
A function that converts a dense matrix to a sparse matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldc), | intent(in) | :: | dense_matrix | The matrix to convert. |
||
type(Matrix_lsc), | intent(inout) | :: | sparse_matrix | The sparse output matrix. |
||
real(kind=NTREAL), | intent(in), | optional | :: | threshold_in | Value for pruning values to zero. |
Copy the matrix A into the B.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldr), | intent(in) | :: | matA | The matrix to copy. |
||
type(Matrix_ldr), | intent(inout) | :: | matB | matB = matA |
Copy the matrix A into the B.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldc), | intent(in) | :: | matA | The matrix to copy. |
||
type(Matrix_ldc), | intent(inout) | :: | matB | matB = matA |
Deallocate the memory associated with this matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldr), | intent(inout) | :: | this | The matrix to delete. |
Deallocate the memory associated with this matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldc), | intent(inout) | :: | this | This the matrix to delete. |
Split a sparse matrix into an array of sparse matrices.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldr), | 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_ldr), | intent(inout), | DIMENSION(:,:) | :: | split_array | A block_columns x block_rows 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_ldc), | 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_ldc), | 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. |
Create a big matrix from an array of matrices by putting them one next to another.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldr), | 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_ldr), | 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_ldc), | 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_ldc), | intent(inout) | :: | out_matrix | The composed matrix. |
Compute the norm of a dense matrix. Computes the Frobenius norm.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldr), | intent(in) | :: | this | The matrix to compute the norm of. |
The norm of the matrix.
Compute the norm of a dense matrix. Computes the Frobenius norm.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldc), | intent(in) | :: | this | The matrix to compute the norm of. |
The norm of the matrix.
AXPY for dense matrices. B = B + alpha*A
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldr), | intent(in) | :: | MatA | MatA is added |
||
type(Matrix_ldr), | intent(inout) | :: | MatB | MatB is incremented. |
||
real(kind=NTREAL), | intent(in), | optional | :: | alpha_in | A scaling parameter. |
AXPY for dense matrices. B = B + alpha*A
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldc), | intent(in) | :: | MatA | MatA is added |
||
type(Matrix_ldc), | intent(inout) | :: | MatB | MatB is incremented. |
||
real(kind=NTREAL), | intent(in), | optional | :: | alpha_in | A scaling parameter. |
A wrapper for multiplying two dense matrices.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldr), | intent(in) | :: | MatA | The first matrix. |
||
type(Matrix_ldr), | intent(in) | :: | MatB | The second matrix. |
||
type(Matrix_ldr), | intent(inout) | :: | MatC | MatC = MatA*MatB. |
||
logical, | intent(in), | optional | :: | IsATransposed_in | True if A is already transposed. |
|
logical, | intent(in), | optional | :: | IsBTransposed_in | True if B is already transposed. |
A wrapper for multiplying two dense matrices.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldc), | intent(in) | :: | MatA | The first matrix. |
||
type(Matrix_ldc), | intent(in) | :: | MatB | The second matrix. |
||
type(Matrix_ldc), | intent(inout) | :: | MatC | MatC = MatA*MatB. |
||
logical, | intent(in), | optional | :: | IsATransposed_in | True if A is already transposed. |
|
logical, | intent(in), | optional | :: | IsBTransposed_in | True if B is already transposed. |
Transpose a dense matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldr), | intent(in) | :: | matA | matA the matrix to transpose. |
||
type(Matrix_ldr), | intent(inout) | :: | matAT | matAT = matA^T. |
Transpose a dense matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Matrix_ldc), | intent(in) | :: | matA | The matrix to transpose. |
||
type(Matrix_ldc), | intent(inout) | :: | matAT | matAT = matA^T. |
A datatype for storing a dense matrix.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=NTREAL), | public, | DIMENSION(:,:), ALLOCATABLE | :: | DATA | values of the matrix. |
||
integer, | public | :: | rows | Matrix dimension: rows. |
|||
integer, | public | :: | columns | Matrix dimension: columns. |
private pure function ConstructEmptyMatrix_ldr(rows, columns) | Construct an empty dense matrix with a set number of rows and columns |
A datatype for storing a dense matrix.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
complex(kind=NTCOMPLEX), | public, | DIMENSION(:,:), ALLOCATABLE | :: | DATA | values of the matrix. |
||
integer, | public | :: | rows | Matrix dimension: rows. |
|||
integer, | public | :: | columns | Matrix dimension: columns. |
private pure function ConstructEmptyMatrix_ldc(rows, columns) | Construct an empty dense matrix with a set number of rows and columns |