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.

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

    v = innerprod(X, y)

    ! ... Rest of your code ...

Similarly, for computing the matrix of inner products between two bases

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

    M = innerprod(X, Y)

    ! ... Rest of your code ...

Module Procedures

private function innerprod_vector_rsp(X, y) result(v)

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

Arguments

Type IntentOptional Attributes Name
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.

Return Value real(kind=sp), (size(X))

Resulting inner-product vector.

private function innerprod_matrix_rsp(X, Y) result(M)

Computes the inner product matrix between two bases of abstract_vector.

Arguments

Type IntentOptional Attributes Name
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.

Return Value real(kind=sp), (size(X),size(Y))

Resulting inner-product matrix.

private function innerprod_vector_rdp(X, y) result(v)

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

Arguments

Type IntentOptional Attributes Name
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.

Return Value real(kind=dp), (size(X))

Resulting inner-product vector.

private function innerprod_matrix_rdp(X, Y) result(M)

Computes the inner product matrix between two bases of abstract_vector.

Arguments

Type IntentOptional Attributes Name
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.

Return Value real(kind=dp), (size(X),size(Y))

Resulting inner-product matrix.

private function innerprod_vector_csp(X, y) result(v)

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

Arguments

Type IntentOptional Attributes Name
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.

Return Value complex(kind=sp), (size(X))

Resulting inner-product vector.

private function innerprod_matrix_csp(X, Y) result(M)

Computes the inner product matrix between two bases of abstract_vector.

Arguments

Type IntentOptional Attributes Name
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.

Return Value complex(kind=sp), (size(X),size(Y))

Resulting inner-product matrix.

private function innerprod_vector_cdp(X, y) result(v)

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

Arguments

Type IntentOptional Attributes Name
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.

Return Value complex(kind=dp), (size(X))

Resulting inner-product vector.

private function innerprod_matrix_cdp(X, Y) result(M)

Computes the inner product matrix between two bases of abstract_vector.

Arguments

Type IntentOptional Attributes Name
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.

Return Value complex(kind=dp), (size(X),size(Y))

Resulting inner-product matrix.