NTPoly
Functions/Subroutines
sparsematrixalgebramodule Module Reference

A module for performing linear algebra using sparse matrices. More...

Functions/Subroutines

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...
 

Detailed Description

A module for performing linear algebra using sparse matrices.

Function/Subroutine Documentation

◆ 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]matAMatrix A.
[in]matBMatrix 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]matAMatrix A.
[in]matBMatrix B.
[out]matC= alpha*matA*op( matB ) + beta*matC.
[in]IsATransposed_intrue if A is already transposed.
[in]IsBTransposed_intrue if B is already transposed.
[in]alpha_inscales the multiplication.
[in]beta_inscales matrix we sum on to.
[in]threshold_infor flushing values to zero. Default value is 0.0.
[in,out]blocked_memory_pool_inan 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]matAMatrix A.
[in,out]matBMatrix B.
[in]alpha_inmultiplier. Optional, default is 1.0
[in]threshold_infor 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]matAMatrix A.
[in]matBMatrix 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]matAMatrix A.
[in]constantscale factor.

◆ sparsematrixgrandsum()

pure real(ntreal) function, public sparsematrixalgebramodule::sparsematrixgrandsum ( type(sparsematrix_t), intent(in)  this)

Sum the elements of a matrix.

Parameters
[in]thisthe 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]thisthe matrix to compute the norm of.
[out]norm_per_columnthe norm value for each column in this matrix.