abstract_vector_rdp Derived Type

type, public, abstract, extends(abstract_vector) :: abstract_vector_rdp

Abstract type to define real(dp)-valued vectors. Derived-types defined by the user should be extending one such class.


Type-Bound Procedures

procedure, public, pass(self) :: add => add_rdp

Adds two abstract_vector, i.e. .

  • private subroutine add_rdp(self, vec)

    Add two abstract_vector in-place.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(inout) :: self

    Input/Output vector.

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

    Vector to be added.

procedure(abstract_axpby_rdp), public, deferred, pass(self) :: axpby

In-place computation of .

  • subroutine abstract_axpby_rdp(alpha, vec, beta, self) Prototype

    Abstract interface to add/scale two vectors in-place.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: alpha
    class(abstract_vector_rdp), intent(in) :: vec

    Vector to be added/subtracted.

    real(kind=dp), intent(in) :: beta
    class(abstract_vector_rdp), intent(inout) :: self

    Input/Output vector.

procedure, public, pass(self) :: chsgn => chsgn_rdp

Change the sign of a vector, i.e. .

  • private subroutine chsgn_rdp(self)

    Changes the sign of the abstract_vector.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(inout) :: self

    Vector whose entries need to change sign.

procedure(abstract_dot_rdp), public, deferred, pass(self) :: dot

Computes the dot product between two abstract_vector_rdp.

  • function abstract_dot_rdp(self, vec) result(alpha) Prototype

    Abstract interface to compute the dot product.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(in) :: self

    Vectors whose dot product will be computed.

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

    Vectors whose dot product will be computed.

    Return Value real(kind=dp)

    Result of the dot product.

procedure(abstract_get_size_rdp), public, deferred, pass(self) :: get_size

Return size of specific abstract vector

  • function abstract_get_size_rdp(self) result(N) Prototype

    Abstract interface to return the size of the specific abstract vector.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(in) :: self

    Vector for which to return the size.

    Return Value integer

    Size of the vector

procedure, public, pass(self) :: norm => norm_rdp

Computes the norm of the abstract_vector.

  • private function norm_rdp(self) result(alpha)

    Compute the norm of an abstract_vector.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(in) :: self

    Vector whose norm needs to be computed.

    Return Value real(kind=dp)

    Norm of the vector.

procedure(abstract_rand_rdp), public, deferred, pass(self) :: rand

Creates a random abstract_vector_rdp.

  • subroutine abstract_rand_rdp(self, ifnorm) Prototype

    Abstract interface to generate a random (normalized) vector.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(inout) :: self

    Vector to be initialized.

    logical, intent(in), optional :: ifnorm

procedure(abstract_scal_rdp), public, deferred, pass(self) :: scal

Compute the scalar-vector product.

  • subroutine abstract_scal_rdp(self, alpha) Prototype

    Abstract interface to scale a vector.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(inout) :: self

    Vector to be scaled.

    real(kind=dp), intent(in) :: alpha

    Scaling factor.

procedure, public, pass(self) :: sub => sub_rdp

Subtracts two abstract_vector, i.e. .

  • private subroutine sub_rdp(self, vec)

    Subtract two abstract_vector in-place.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(inout) :: self

    Input/Output vector.

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

    Vector to be subtracted.

procedure(abstract_zero_rdp), public, deferred, pass(self) :: zero

Sets an abstract_vector_rdp to zero.

  • subroutine abstract_zero_rdp(self) Prototype

    Abstract interface to zero-out a vector in-place.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(inout) :: self

    Vector to be zeroed-out.

Source Code

    type, abstract, extends(abstract_vector), public :: abstract_vector_rdp
        !!  Abstract type to define real(dp)-valued vectors.
        !!  Derived-types defined by the user should be extending one such class.
    contains
        private
        procedure(abstract_zero_rdp), pass(self), deferred, public :: zero
        !! Sets an `abstract_vector_rdp` to zero.
        procedure(abstract_rand_rdp), pass(self), deferred, public :: rand
        !! Creates a random `abstract_vector_rdp`.
        procedure(abstract_scal_rdp), pass(self), deferred, public :: scal
        !! Compute the scalar-vector product.
        procedure(abstract_axpby_rdp), pass(self), deferred, public :: axpby
        !! In-place computation of \( \mathbf{y} \leftarrow \alpha \mathbf{x} + \beta \mathbf{y} \).
        procedure(abstract_dot_rdp), pass(self), deferred, public :: dot
        !! Computes the dot product between two `abstract_vector_rdp`.
        procedure(abstract_get_size_rdp), pass(self), deferred, public :: get_size
        !! Return size of specific abstract vector
        procedure, pass(self), public :: norm => norm_rdp
        !! Computes the norm of the `abstract_vector`.
        procedure, pass(self), public :: add => add_rdp
        !! Adds two `abstract_vector`, i.e. \( \mathbf{y} \leftarrow \mathbf{x} + \mathbf{y}\).
        procedure, pass(self), public :: sub => sub_rdp
        !! Subtracts two `abstract_vector`, i.e. \( \mathbf{y} \leftarrow \mathbf{y} - \mathbf{x} \).
        procedure, pass(self), public :: chsgn => chsgn_rdp
        !! Change the sign of a vector, i.e. \( \mathbf{x} \leftarrow -\mathbf{x} \).
    end type abstract_vector_rdp