SMatrixAlgebraModule Module

A module for performing linear algebra using sparse matrices.



Contents


Interfaces

public interface ScaleMatrix

  • private subroutine ScaleMatrix_lsr(matA, constant)

    Will scale a sparse matrix by a constant.

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsr), intent(inout) :: matA

    Matrix A.

    real(kind=NTREAL), intent(in) :: constant

    Constant scale factor.

  • private subroutine ScaleMatrix_lsc(matA, constant)

    Will scale a sparse matrix by a constant.

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsc), intent(inout) :: matA

    Matrix A.

    real(kind=NTREAL), intent(in) :: constant

    Constant scale factor.

  • private subroutine ScaleMatrix_lsc_c(matA, constant)

    Will scale a sparse matrix by a constant. Will scale a sparse matrix by a constant.

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsc), intent(inout) :: matA

    Matrix A.

    complex(kind=NTCOMPLEX), intent(in) :: constant

    Constant scale factor.

public interface IncrementMatrix

  • private subroutine IncrementMatrix_lsr(matA, matB, alpha_in, threshold_in)

    Matrix B = alpha*Matrix A + Matrix B (AXPY). This will utilize the sparse vector addition routine.

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsr), intent(in) :: matA

    Matrix A.

    type(Matrix_lsr), intent(inout) :: matB

    Matrix B.

    real(kind=NTREAL), intent(in), optional :: alpha_in

    Multiplier (default=1.0).

    real(kind=NTREAL), intent(in), optional :: threshold_in

    For flushing values to zero (default=0).

  • private subroutine IncrementMatrix_lsc(matA, matB, alpha_in, threshold_in)

    Matrix B = alpha*Matrix A + Matrix B (AXPY). This will utilize the sparse vector addition routine.

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsc), intent(in) :: matA

    Matrix A.

    type(Matrix_lsc), intent(inout) :: matB

    Matrix B.

    real(kind=NTREAL), intent(in), optional :: alpha_in

    Multiplier (default=1.0).

    real(kind=NTREAL), intent(in), optional :: threshold_in

    For flushing values to zero (default=0).

public interface DotMatrix

  • private subroutine DotMatrix_lsr(matA, matB, product)

    Product = sum(MatA[ij]*MatB[ij])

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsr), intent(in) :: matA

    Matrix A.

    type(Matrix_lsr), intent(in) :: matB

    Matrix B.

    real(kind=NTREAL), intent(out) :: product

    Dot product.

  • private subroutine DotMatrix_lsc(matA, matB, product)

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsc), intent(in) :: matA

    Matrix A.

    type(Matrix_lsc), intent(in) :: matB

    Matrix B.

    complex(kind=NTCOMPLEX), intent(out) :: product

    Dot product.

public interface PairwiseMultiplyMatrix

  • private subroutine PairwiseMultiplyMatrix_lsr(matA, matB, matC)

    Pairwise Multiply two matrices. This will utilize the sparse vector pairwise multiply routine.

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsr), intent(in) :: matA

    Matrix A.

    type(Matrix_lsr), intent(in) :: matB

    Matrix B.

    type(Matrix_lsr), intent(inout) :: matC

    matC = MatA mult MatB.

  • private subroutine PairwiseMultiplyMatrix_lsc(matA, matB, matC)

    Pairwise Multiply two matrices. This will utilize the sparse vector pairwise routine.

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsc), intent(in) :: matA

    Matrix A.

    type(Matrix_lsc), intent(in) :: matB

    Matrix B.

    type(Matrix_lsc), intent(inout) :: matC

    matC = MatA mult MatB.

public interface MatrixMultiply

  • private subroutine GemmMatrix_lsr(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 := alphamatAop( matB ) + beta*matC

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsr), intent(in) :: matA

    Matrix A.

    type(Matrix_lsr), intent(in) :: matB

    Matrix B.

    type(Matrix_lsr), intent(inout) :: matC

    matC = alphamatAop( matB ) + beta*matC.

    logical, intent(in), optional :: IsATransposed_in

    True if A is already transposed.

    logical, intent(in), optional :: IsBTransposed_in

    True if B is already transposed.

    real(kind=NTREAL), intent(in), optional :: alpha_in

    Scales the multiplication.

    real(kind=NTREAL), intent(in), optional :: beta_in

    Scales matrix we sum on to.

    real(kind=NTREAL), intent(in), optional :: threshold_in

    For flushing values to zero. Default value is 0.0.

    type(MatrixMemoryPool_lr), intent(inout), optional TARGET:: blocked_memory_pool_in

    An optional memory pool for doing the calculation.

  • private subroutine GemmMatrix_lsc(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 := alphamatAop( matB ) + beta*matC

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsc), intent(in) :: matA

    Matrix A.

    type(Matrix_lsc), intent(in) :: matB

    Matrix B.

    type(Matrix_lsc), intent(inout) :: matC

    matC = alphamatAop( matB ) + beta*matC.

    logical, intent(in), optional :: IsATransposed_in

    True if A is already transposed.

    logical, intent(in), optional :: IsBTransposed_in

    True if B is already transposed.

    real(kind=NTREAL), intent(in), optional :: alpha_in

    Scales the multiplication.

    real(kind=NTREAL), intent(in), optional :: beta_in

    Scales matrix we sum on to.

    real(kind=NTREAL), intent(in), optional :: threshold_in

    For flushing values to zero. Default value is 0.0.

    type(MatrixMemoryPool_lc), intent(inout), optional TARGET:: blocked_memory_pool_in

    An optional memory pool for doing the calculation.

public interface MatrixColumnNorm

  • private subroutine MatrixColumnNorm_lsr(this, norm_per_column)

    Compute the norm of a sparse matrix along the columns.

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsr), intent(in) :: this

    The matrix to compute the norm of.

    real(kind=NTREAL), intent(out), DIMENSION(this%columns):: norm_per_column

    The norm value for each column in this matrix.

  • private subroutine MatrixColumnNorm_lsc(this, norm_per_column)

    Compute the norm of a sparse matrix along the columns.

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsc), intent(in) :: this

    The matrix to compute the norm of.

    real(kind=NTREAL), intent(out), DIMENSION(this%columns):: norm_per_column

    The norm value for each column in this matrix.

public interface MatrixNorm

  • private pure function MatrixNorm_lsr(this) result(norm)

    Compute the 1 norm of a sparse matrix.

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsr), intent(in) :: this

    The matrix to compute the norm of.

    Return Value real(kind=NTREAL)

    The norm of the matrix.

  • private pure function MatrixNorm_lsc(this) result(norm)

    Compute the 1 norm of a sparse matrix.

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsc), intent(in) :: this

    The matrix to compute the norm of.

    Return Value real(kind=NTREAL)

    The norm of the matrix.

public interface MatrixGrandSum

  • private subroutine MatrixGrandSum_lsr(this, sum_value)

    Sum the elements of a matrix

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsr), intent(in) :: this

    The matrix to sum

    real(kind=NTREAL), intent(out) :: sum_value

    The sum of the matrix elements

  • private subroutine MatrixGrandSum_lsc(this, sum_value)

    Sum the elements of a matrix

    Arguments

    Type IntentOptional AttributesName
    type(Matrix_lsc), intent(in) :: this

    The matrix to sum

    complex(kind=NTCOMPLEX), intent(out) :: sum_value

    The sum of the matrix elements