innerprod Interface

public interface innerprod

Compute the inner product vector or matrix .

Description

This interface provides methods for computing the inner products between a basis of real or complex vectors and a single vector or another basis . Depending on the case, it returns a one-dimensional array or a two-dimensional array with the same type as .

Example

The example below assumes that you have already extended the abstract_vector_rdp class to define your own my_real_vector type. It then computes the inner product vector defined as .

    type(my_real_vector), dimension(10) :: X
    type(my_real_vector)                :: y
    real(dp), dimension(:), allocatable :: v

    ! ... Part of your code where you initialize everything ...

    call innerprod(v, X, y)

    ! ... Rest of your code ...

Similarly, computing the matrix of inner products between two bases can be done as shown below.

    type(my_real_vector), dimension(10) :: X
    type(my_real_vector), dimension(10) :: Y
    real(dp), dimension(:, :), allocatable :: M

    ! ... Part of your code where you initialize everything ...

    call innerprod(M, X, Y)

    ! ... Rest of your code ...

Module Procedures

private subroutine innerprod_vector_rsp(v, X, y)

Computes the inner product vector between a basis X of abstract_vector and v, a single abstract_vector.

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(out) :: v(size(X))

Resulting inner-product vector.

class(abstract_vector_rsp), intent(in) :: X(:)

Bases of abstract_vector whose inner products need to be computed.

class(abstract_vector_rsp), intent(in) :: y

Bases of abstract_vector whose inner products need to be computed.

private subroutine innerprod_matrix_rsp(M, X, Y)

Computes the inner product matrix between two bases of abstract_vector.

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(out) :: M(size(X),size(Y))

Resulting inner-product matrix.

class(abstract_vector_rsp), intent(in) :: X(:)

Bases of abstract_vector whose inner products need to be computed.

class(abstract_vector_rsp), intent(in) :: Y(:)

Bases of abstract_vector whose inner products need to be computed.

private subroutine innerprod_vector_rdp(v, X, y)

Computes the inner product vector between a basis X of abstract_vector and v, a single abstract_vector.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out) :: v(size(X))

Resulting inner-product vector.

class(abstract_vector_rdp), intent(in) :: X(:)

Bases of abstract_vector whose inner products need to be computed.

class(abstract_vector_rdp), intent(in) :: y

Bases of abstract_vector whose inner products need to be computed.

private subroutine innerprod_matrix_rdp(M, X, Y)

Computes the inner product matrix between two bases of abstract_vector.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(out) :: M(size(X),size(Y))

Resulting inner-product matrix.

class(abstract_vector_rdp), intent(in) :: X(:)

Bases of abstract_vector whose inner products need to be computed.

class(abstract_vector_rdp), intent(in) :: Y(:)

Bases of abstract_vector whose inner products need to be computed.

private subroutine innerprod_vector_csp(v, X, y)

Computes the inner product vector between a basis X of abstract_vector and v, a single abstract_vector.

Arguments

Type IntentOptional Attributes Name
complex(kind=sp), intent(out) :: v(size(X))

Resulting inner-product vector.

class(abstract_vector_csp), intent(in) :: X(:)

Bases of abstract_vector whose inner products need to be computed.

class(abstract_vector_csp), intent(in) :: y

Bases of abstract_vector whose inner products need to be computed.

private subroutine innerprod_matrix_csp(M, X, Y)

Computes the inner product matrix between two bases of abstract_vector.

Arguments

Type IntentOptional Attributes Name
complex(kind=sp), intent(out) :: M(size(X),size(Y))

Resulting inner-product matrix.

class(abstract_vector_csp), intent(in) :: X(:)

Bases of abstract_vector whose inner products need to be computed.

class(abstract_vector_csp), intent(in) :: Y(:)

Bases of abstract_vector whose inner products need to be computed.

private subroutine innerprod_vector_cdp(v, X, y)

Computes the inner product vector between a basis X of abstract_vector and v, a single abstract_vector.

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(out) :: v(size(X))

Resulting inner-product vector.

class(abstract_vector_cdp), intent(in) :: X(:)

Bases of abstract_vector whose inner products need to be computed.

class(abstract_vector_cdp), intent(in) :: y

Bases of abstract_vector whose inner products need to be computed.

private subroutine innerprod_matrix_cdp(M, X, Y)

Computes the inner product matrix between two bases of abstract_vector.

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(out) :: M(size(X),size(Y))

Resulting inner-product matrix.

class(abstract_vector_cdp), intent(in) :: X(:)

Bases of abstract_vector whose inner products need to be computed.

class(abstract_vector_cdp), intent(in) :: Y(:)

Bases of abstract_vector whose inner products need to be computed.