A module for performing linear algebra using sparse matrices.
More...
|
pure subroutine, public | scalesparsematrix (matA, constant) |
| Will scale a sparse matrix by a constant. More...
|
|
pure subroutine, public | incrementsparsematrix (matA, matB, alpha_in, threshold_in) |
| Matrix B = alpha*Matrix A + Matrix B (AXPY). This will utilize the sparse vector addition routine. More...
|
|
pure subroutine, public | pairwisemultiplysparsematrix (matA, matB, matC) |
| Pairwise Multiply two matrices. This will utilize the sparse vector pairwise routine. More...
|
|
pure real(ntreal) function, public | dotsparsematrix (matA, matB) |
| Product = sum(MatA[ij]*MatB[ij]) More...
|
|
subroutine, public | gemm (matA, matB, matC, IsATransposed_in, IsBTransposed_in, alpha_in, beta_in, threshold_in, blocked_memory_pool_in) |
| Multiply two matrices together, and add to the third. C := alpha*matA*op( matB ) + beta*matC This version is not really linear scaling, but it should be fast enough. Basically, we create a big buffer region of zeros so that we can accumulate in O(1) time. Then we scan over the buffer region and search for filled values. For small enough matrices this is fine, but it definitely isn't optimal. More...
|
|
pure subroutine, public | sparsematrixnorm (this, norm_per_column) |
| Compute the norm of a sparse matrix along the columns. More...
|
|
pure real(ntreal) function, public | sparsematrixgrandsum (this) |
| Sum the elements of a matrix. More...
|
|
A module for performing linear algebra using sparse matrices.
◆ dotsparsematrix()
pure real(ntreal) function, public sparsematrixalgebramodule::dotsparsematrix |
( |
type(sparsematrix_t), intent(in) |
matA, |
|
|
type(sparsematrix_t), intent(in) |
matB |
|
) |
| |
Product = sum(MatA[ij]*MatB[ij])
- Parameters
-
[in] | matA | Matrix A. |
[in] | matB | Matrix B. |
- Returns
- product
◆ gemm()
subroutine, public sparsematrixalgebramodule::gemm |
( |
type(sparsematrix_t), intent(in) |
matA, |
|
|
type(sparsematrix_t), intent(in) |
matB, |
|
|
type(sparsematrix_t), intent(inout) |
matC, |
|
|
logical, intent(in), optional |
IsATransposed_in, |
|
|
logical, intent(in), optional |
IsBTransposed_in, |
|
|
real(ntreal), intent(in), optional |
alpha_in, |
|
|
real(ntreal), intent(in), optional |
beta_in, |
|
|
real(ntreal), intent(in), optional |
threshold_in, |
|
|
type(matrixmemorypool_t), intent(inout), optional, target |
blocked_memory_pool_in |
|
) |
| |
Multiply two matrices together, and add to the third. C := alpha*matA*op( matB ) + beta*matC This version is not really linear scaling, but it should be fast enough. Basically, we create a big buffer region of zeros so that we can accumulate in O(1) time. Then we scan over the buffer region and search for filled values. For small enough matrices this is fine, but it definitely isn't optimal.
- Parameters
-
[in] | matA | Matrix A. |
[in] | matB | Matrix B. |
[out] | matC | = alpha*matA*op( matB ) + beta*matC. |
[in] | IsATransposed_in | true if A is already transposed. |
[in] | IsBTransposed_in | true if B is already transposed. |
[in] | alpha_in | scales the multiplication. |
[in] | beta_in | scales matrix we sum on to. |
[in] | threshold_in | for flushing values to zero. Default value is 0.0. |
[in,out] | blocked_memory_pool_in | an optional memory pool for doing the calculation. |
◆ incrementsparsematrix()
pure subroutine, public sparsematrixalgebramodule::incrementsparsematrix |
( |
type(sparsematrix_t), intent(in) |
matA, |
|
|
type(sparsematrix_t), intent(inout) |
matB, |
|
|
real(ntreal), intent(in), optional |
alpha_in, |
|
|
real(ntreal), intent(in), optional |
threshold_in |
|
) |
| |
Matrix B = alpha*Matrix A + Matrix B (AXPY). This will utilize the sparse vector addition routine.
- Parameters
-
[in] | matA | Matrix A. |
[in,out] | matB | Matrix B. |
[in] | alpha_in | multiplier. Optional, default is 1.0 |
[in] | threshold_in | for flushing values to zero. Default value is 0.0. |
- Todo:
- I don't like this hack where I have to check if MatrixB is allocated.
◆ pairwisemultiplysparsematrix()
pure subroutine, public sparsematrixalgebramodule::pairwisemultiplysparsematrix |
( |
type(sparsematrix_t), intent(in) |
matA, |
|
|
type(sparsematrix_t), intent(in) |
matB, |
|
|
type(sparsematrix_t), intent(inout) |
matC |
|
) |
| |
Pairwise Multiply two matrices. This will utilize the sparse vector pairwise routine.
- Parameters
-
[in] | matA | Matrix A. |
[in] | matB | Matrix B. |
[in,out] | matC | = MatA mult MatB. |
◆ scalesparsematrix()
pure subroutine, public sparsematrixalgebramodule::scalesparsematrix |
( |
type(sparsematrix_t), intent(inout) |
matA, |
|
|
real(ntreal), intent(in) |
constant |
|
) |
| |
Will scale a sparse matrix by a constant.
- Parameters
-
[in,out] | matA | Matrix A. |
[in] | constant | scale factor. |
◆ sparsematrixgrandsum()
pure real(ntreal) function, public sparsematrixalgebramodule::sparsematrixgrandsum |
( |
type(sparsematrix_t), intent(in) |
this | ) |
|
Sum the elements of a matrix.
- Parameters
-
[in] | this | the matrix to sum |
- Returns
- sum_value the sum of the matrix elements
◆ sparsematrixnorm()
pure subroutine, public sparsematrixalgebramodule::sparsematrixnorm |
( |
type(sparsematrix_t), intent(in) |
this, |
|
|
real(ntreal), dimension(:), intent(out), allocatable |
norm_per_column |
|
) |
| |
Compute the norm of a sparse matrix along the columns.
- Parameters
-
[in] | this | the matrix to compute the norm of. |
[out] | norm_per_column | the norm value for each column in this matrix. |