LightKrylov_AbstractVectors Module

This module provides the base class absract_vector from which all Krylov vectors needs to be derived. To use LightKrylov, you need to extend one of the followings:

  • abstract_vector_rsp : Real-valued vector with single precision arithmetic.
  • abstract_vector_rdp : Real-valued vector with double precision arithmetic.
  • abstract_vector_csp : Complex-valued vector with single precision arithmetic.
  • abstract_vector_cdp : Complex-valued vector with double precision arithmetic.

To extend either of these abstract types, you need to provide an associated implementation for the following type-bound procedures:

  • zero(self) : A subroutine zeroing-out the vector.
  • rand(self, ifnorm) : A subroutine creating a random vector, possibily normalized to have unit-norm (ifnorm = .true.).
  • scal(self, alpha) : A subroutine computing in-place the scalar multiplication .
  • `axpby(alpha, vec, beta, self) : A subroutine computing in-place the product .
  • dot(self, vec) : A function computing the inner product .
  • get_size(self) : A function returning the dimension of the vector .

Once these type-bound procedures have been implemented by the user, they will automatically be used to define:

  • vector addition : add(self, vec) = axpby(1, vec, 1, self)
  • vector subtraction : sub(self, vec) = axpby(-1, vec, 1, self)
  • vector norm : norm(self) = sqrt(self%dot(self))

This module also provides the following utility subroutines:

  • innerprod(X, Y) : Function computing the product between a Krylov basis X and a Krylov vector (resp. basis) Y.
  • linear_combination(Y, X, V) : Subroutine computing the linear combination .
  • axpby_basis(alpha, X, beta, Y) : In-place computation of where X and Y are arrays of abstract_vector.
  • zero_basis(X) : Zero-out a collection of abstract_vectors.
  • copy_basis(out, from) : Copy a collection of abstract_vectors.
  • rand_basis(X, ifnorm) : Create a collection of random abstract_vectors. If ifnorm = .true., the vectors are normalized to have unit-norm.

Warning

The resulting vectors do not form an orthonormal basis. For this purpose use the utility function initialize_random_orthonormal_basis.


Uses


Interfaces

public interface Gram

Compute the Gram matrix .

Description

This interface provides methods for computing the Gram matrix associated to a basis of abstract_vector .

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
    real(dp), dimension(:, :), allocatable :: G

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

    G = Gram(X)

    ! ... Rest of your code ...
  • private function gram_matrix_rsp(X) result(G)

    Computes the inner product/Gram matrix associated with the basis .

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rsp), intent(in) :: X(:)

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

  • private function gram_matrix_rdp(X) result(G)

    Computes the inner product/Gram matrix associated with the basis .

    Arguments

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

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

  • private function gram_matrix_csp(X) result(G)

    Computes the inner product/Gram matrix associated with the basis .

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_csp), intent(in) :: X(:)

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

  • private function gram_matrix_cdp(X) result(G)

    Computes the inner product/Gram matrix associated with the basis .

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_cdp), intent(in) :: X(:)

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

public interface axpby_basis

In-place addition of two arrays of extended abstract_vector.

Description

This interface provides methods to add in-place two arrays of extended abstract_vector, i.e.

No out-of-place alternative is currently available in LightKrylov. If you do need an out-of-place version, you can combine axpby_basis with copy.

Example

    type(my_real_vector), dimension(10) :: X
    type(my_real_vector), dimension(10) :: Y
    real(dp), dimension(10)             :: alpha, beta

    ! ... Whatever your code is doing ...

    call axpby_basis(alpha, X, beta, Y)

    ! ... Rest of your code ...
  • private impure elemental subroutine axpby_basis_rsp(alpha, X, beta, Y)

    Compute in-place where X and Y are arrays of abstract_vector and alpha and beta are real(sp) numbers.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(in) :: alpha

    Scalar multipliers.

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

    Input/Ouput array of abstract_vector.

    real(kind=sp), intent(in) :: beta

    Scalar multipliers.

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

    Array of abstract_vector to be added/subtracted to/from X.

  • private impure elemental subroutine axpby_basis_rdp(alpha, X, beta, Y)

    Compute in-place where X and Y are arrays of abstract_vector and alpha and beta are real(dp) numbers.

    Arguments

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

    Scalar multipliers.

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

    Input/Ouput array of abstract_vector.

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

    Scalar multipliers.

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

    Array of abstract_vector to be added/subtracted to/from X.

  • private impure elemental subroutine axpby_basis_csp(alpha, X, beta, Y)

    Compute in-place where X and Y are arrays of abstract_vector and alpha and beta are complex(sp) numbers.

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=sp), intent(in) :: alpha

    Scalar multipliers.

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

    Input/Ouput array of abstract_vector.

    complex(kind=sp), intent(in) :: beta

    Scalar multipliers.

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

    Array of abstract_vector to be added/subtracted to/from X.

  • private impure elemental subroutine axpby_basis_cdp(alpha, X, beta, Y)

    Compute in-place where X and Y are arrays of abstract_vector and alpha and beta are complex(dp) numbers.

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=dp), intent(in) :: alpha

    Scalar multipliers.

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

    Input/Ouput array of abstract_vector.

    complex(kind=dp), intent(in) :: beta

    Scalar multipliers.

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

    Array of abstract_vector to be added/subtracted to/from X.

public interface copy

This interface provides methods to copy an array X of abstract_vector into another array Y. Note that Y needs to be pre-allocated.

Example

    type(my_real_vector), dimension(10) :: X
    type(my_real_vector), dimension(10) :: Y

    ! ... Your code ...

    call copy(Y, X)

    ! ... Your code ...
  • private impure elemental subroutine copy_vector_rsp(out, from)

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rsp), intent(out) :: out
    class(abstract_vector_rsp), intent(in) :: from
  • private impure elemental subroutine copy_vector_rdp(out, from)

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(out) :: out
    class(abstract_vector_rdp), intent(in) :: from
  • private impure elemental subroutine copy_vector_csp(out, from)

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_csp), intent(out) :: out
    class(abstract_vector_csp), intent(in) :: from
  • private impure elemental subroutine copy_vector_cdp(out, from)

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_cdp), intent(out) :: out
    class(abstract_vector_cdp), intent(in) :: from

public interface dense_vector

  • private function initialize_dense_vector_from_array_rsp(x) result(vec)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=sp), intent(in) :: x(:)

    Return Value type(dense_vector_rsp)

  • private function initialize_dense_vector_from_array_rdp(x) result(vec)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=dp), intent(in) :: x(:)

    Return Value type(dense_vector_rdp)

  • private function initialize_dense_vector_from_array_csp(x) result(vec)

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=sp), intent(in) :: x(:)

    Return Value type(dense_vector_csp)

  • private function initialize_dense_vector_from_array_cdp(x) result(vec)

    Arguments

    Type IntentOptional Attributes Name
    complex(kind=dp), intent(in) :: x(:)

    Return Value type(dense_vector_cdp)

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 ...
  • private function innerprod_vector_rsp(X, v) result(y)

    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(:)

    Basis and single instance of abstract_vector whose inner products need to be computed.

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

    Basis and single instance 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, v) result(y)

    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(:)

    Basis and single instance of abstract_vector whose inner products need to be computed.

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

    Basis and single instance 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, v) result(y)

    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(:)

    Basis and single instance of abstract_vector whose inner products need to be computed.

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

    Basis and single instance 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, v) result(y)

    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(:)

    Basis and single instance of abstract_vector whose inner products need to be computed.

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

    Basis and single instance 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.

public interface linear_combination

Given a set of extended abstract_vectors and coefficients, return the corresponding linear combinations.

Description

This interface provides methods for computing linear combinations of a set of abstract_vectors. Depending on its input, it either computes

i.e. a single vector, or

i.e. a set of vectors of the same type as .

Example

    type(my_real_vector), dimension(10) :: X
    real(dp), dimension(m, n)           :: B
    type(my_real_vector)                :: Y

    ! ... Whatever your code is doing ...

    call linear_combination(Y, X, B)

    ! ... Rest of your code ...
  • private subroutine linear_combination_vector_rsp(y, X, v)

    Given X and v, this function return where y is an abstract_vector, X an array of abstract_vector and v a Fortran array containing the coefficients of the linear combination.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rsp), intent(out), allocatable :: y

    Ouput vector.

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

    Krylov basis.

    real(kind=sp), intent(in) :: v(:)

    Coordinates of y in the Krylov basis X.

  • private subroutine linear_combination_matrix_rsp(Y, X, B)

    Given X and B, this function computes where X and Y are arrays of abstract_vector, and B is a 2D Fortran array.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rsp), intent(out), allocatable :: Y(:)

    Output matrix.

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

    Krylov basis.

    real(kind=sp), intent(in) :: B(:,:)

    Coefficients of the linear combinations.

  • private subroutine linear_combination_vector_rdp(y, X, v)

    Given X and v, this function return where y is an abstract_vector, X an array of abstract_vector and v a Fortran array containing the coefficients of the linear combination.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(out), allocatable :: y

    Ouput vector.

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

    Krylov basis.

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

    Coordinates of y in the Krylov basis X.

  • private subroutine linear_combination_matrix_rdp(Y, X, B)

    Given X and B, this function computes where X and Y are arrays of abstract_vector, and B is a 2D Fortran array.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(out), allocatable :: Y(:)

    Output matrix.

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

    Krylov basis.

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

    Coefficients of the linear combinations.

  • private subroutine linear_combination_vector_csp(y, X, v)

    Given X and v, this function return where y is an abstract_vector, X an array of abstract_vector and v a Fortran array containing the coefficients of the linear combination.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_csp), intent(out), allocatable :: y

    Ouput vector.

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

    Krylov basis.

    complex(kind=sp), intent(in) :: v(:)

    Coordinates of y in the Krylov basis X.

  • private subroutine linear_combination_matrix_csp(Y, X, B)

    Given X and B, this function computes where X and Y are arrays of abstract_vector, and B is a 2D Fortran array.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_csp), intent(out), allocatable :: Y(:)

    Output matrix.

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

    Krylov basis.

    complex(kind=sp), intent(in) :: B(:,:)

    Coefficients of the linear combinations.

  • private subroutine linear_combination_vector_cdp(y, X, v)

    Given X and v, this function return where y is an abstract_vector, X an array of abstract_vector and v a Fortran array containing the coefficients of the linear combination.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_cdp), intent(out), allocatable :: y

    Ouput vector.

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

    Krylov basis.

    complex(kind=dp), intent(in) :: v(:)

    Coordinates of y in the Krylov basis X.

  • private subroutine linear_combination_matrix_cdp(Y, X, B)

    Given X and B, this function computes where X and Y are arrays of abstract_vector, and B is a 2D Fortran array.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_cdp), intent(out), allocatable :: Y(:)

    Output matrix.

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

    Krylov basis.

    complex(kind=dp), intent(in) :: B(:,:)

    Coefficients of the linear combinations.

public interface rand_basis

This interface provides methods to create an array X of random abstract_vector. It is a simple wrapper around X(i)%rand(ifnorm).

Example

    type(my_real_vector), dimension(10) :: X
    logical                             :: ifnorm = .true.

    ! ... Your code ...

    call rand_basis(X, ifnorm)

    ! ... Your code ...
  • private impure elemental subroutine rand_basis_rsp(X, ifnorm)

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rsp), intent(inout) :: X
    logical, intent(in), optional :: ifnorm
  • private impure elemental subroutine rand_basis_rdp(X, ifnorm)

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(inout) :: X
    logical, intent(in), optional :: ifnorm
  • private impure elemental subroutine rand_basis_csp(X, ifnorm)

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_csp), intent(inout) :: X
    logical, intent(in), optional :: ifnorm
  • private impure elemental subroutine rand_basis_cdp(X, ifnorm)

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_cdp), intent(inout) :: X
    logical, intent(in), optional :: ifnorm

public interface verify_vector_axioms

  • private function verify_vector_axioms_rsp(x, ntrials, tolerance) result(success)

    Deals with optional argument. Run all tests to verify axioms. Generate random vectors. Check distributivity. Generate random vectors. Check commutativity. Generate random vector. Check zero element. Generate random vector. Check identity. Generate random vectors. Check associativity. Generate random vectors. Check distributivity. Generate random vector. Check distributivity.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rsp), intent(in) :: x

    Derived-type whose implementation needs to be tested.

    integer, intent(in), optional :: ntrials

    Number of random samples generated for the tests.

    real(kind=sp), intent(in), optional :: tolerance

    Return Value logical

  • private function verify_vector_axioms_rdp(x, ntrials, tolerance) result(success)

    Deals with optional argument. Run all tests to verify axioms. Generate random vectors. Check distributivity. Generate random vectors. Check commutativity. Generate random vector. Check zero element. Generate random vector. Check identity. Generate random vectors. Check associativity. Generate random vectors. Check distributivity. Generate random vector. Check distributivity.

    Arguments

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

    Derived-type whose implementation needs to be tested.

    integer, intent(in), optional :: ntrials

    Number of random samples generated for the tests.

    real(kind=dp), intent(in), optional :: tolerance

    Return Value logical

  • private function verify_vector_axioms_csp(x, ntrials, tolerance) result(success)

    Deals with optional argument. Run all tests to verify axioms. Generate random vectors. Check distributivity. Generate random vectors. Check commutativity. Generate random vector. Check zero element. Generate random vector. Check identity. Generate random vectors. Check associativity. Generate random vectors. Check distributivity. Generate random vector. Check distributivity.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_csp), intent(in) :: x

    Derived-type whose implementation needs to be tested.

    integer, intent(in), optional :: ntrials

    Number of random samples generated for the tests.

    real(kind=sp), intent(in), optional :: tolerance

    Return Value logical

  • private function verify_vector_axioms_cdp(x, ntrials, tolerance) result(success)

    Deals with optional argument. Run all tests to verify axioms. Generate random vectors. Check distributivity. Generate random vectors. Check commutativity. Generate random vector. Check zero element. Generate random vector. Check identity. Generate random vectors. Check associativity. Generate random vectors. Check distributivity. Generate random vector. Check distributivity.

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_cdp), intent(in) :: x

    Derived-type whose implementation needs to be tested.

    integer, intent(in), optional :: ntrials

    Number of random samples generated for the tests.

    real(kind=dp), intent(in), optional :: tolerance

    Return Value logical

public interface zero_basis

This interface provides methods to zero-out a collection of abstract_vector X. It is a simple wrapper around X(i)%zero().

Example

    type(my_real_vector), dimension(10) :: X

    ! ... Your code ...

    call zero_basis(X)

    ! ... Your code ...
  • private impure elemental subroutine zero_basis_rsp(X)

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rsp), intent(inout) :: X
  • private impure elemental subroutine zero_basis_rdp(X)

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_rdp), intent(inout) :: X
  • private impure elemental subroutine zero_basis_csp(X)

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_csp), intent(inout) :: X
  • private impure elemental subroutine zero_basis_cdp(X)

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_vector_cdp), intent(inout) :: X

Derived Types

type, public, abstract ::  abstract_vector

Base abstract type from which all other types of vectors used in LightKrylov are being derived from.

Read more…

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

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

Type-Bound Procedures

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

Adds two abstract_vector, i.e. .

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

In-place computation of .

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

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

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

Computes the dot product between two abstract_vector_cdp.

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

Return size of specific abstract vector

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

Computes the norm of the abstract_vector.

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

Creates a random abstract_vector_cdp.

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

Compute the scalar-vector product.

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

Subtracts two abstract_vector, i.e. .

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

Sets an abstract_vector_cdp to zero.

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

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

Type-Bound Procedures

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

Adds two abstract_vector, i.e. .

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

In-place computation of .

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

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

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

Computes the dot product between two abstract_vector_csp.

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

Return size of specific abstract vector

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

Computes the norm of the abstract_vector.

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

Creates a random abstract_vector_csp.

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

Compute the scalar-vector product.

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

Subtracts two abstract_vector, i.e. .

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

Sets an abstract_vector_csp to zero.

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

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

In-place computation of .

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

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

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

Computes the dot product between two abstract_vector_rdp.

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

Return size of specific abstract vector

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

Computes the norm of the abstract_vector.

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

Creates a random abstract_vector_rdp.

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

Compute the scalar-vector product.

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

Subtracts two abstract_vector, i.e. .

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

Sets an abstract_vector_rdp to zero.

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

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

Type-Bound Procedures

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

Adds two abstract_vector, i.e. .

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

In-place computation of .

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

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

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

Computes the dot product between two abstract_vector_rsp.

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

Return size of specific abstract vector

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

Computes the norm of the abstract_vector.

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

Creates a random abstract_vector_rsp.

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

Compute the scalar-vector product.

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

Subtracts two abstract_vector, i.e. .

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

Sets an abstract_vector_rsp to zero.

type, public, extends(abstract_vector_cdp) ::  dense_vector_cdp

Components

Type Visibility Attributes Name Initial
complex(kind=dp), public, allocatable :: data(:)
integer, public :: n

Type-Bound Procedures

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

Adds two abstract_vector, i.e. .

procedure, public, pass(self) :: axpby => dense_axpby_cdp

In-place computation of .

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

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

procedure, public, pass(self) :: dot => dense_dot_cdp

Computes the dot product between two abstract_vector_cdp.

procedure, public, pass(self) :: get_size => dense_get_size_cdp

Return size of specific abstract vector

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

Computes the norm of the abstract_vector.

procedure, public, pass(self) :: rand => dense_rand_cdp

Creates a random abstract_vector_cdp.

procedure, public, pass(self) :: scal => dense_scal_cdp

Compute the scalar-vector product.

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

Subtracts two abstract_vector, i.e. .

procedure, public, pass(self) :: zero => dense_zero_cdp

Sets an abstract_vector_cdp to zero.

type, public, extends(abstract_vector_csp) ::  dense_vector_csp

Components

Type Visibility Attributes Name Initial
complex(kind=sp), public, allocatable :: data(:)
integer, public :: n

Type-Bound Procedures

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

Adds two abstract_vector, i.e. .

procedure, public, pass(self) :: axpby => dense_axpby_csp

In-place computation of .

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

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

procedure, public, pass(self) :: dot => dense_dot_csp

Computes the dot product between two abstract_vector_csp.

procedure, public, pass(self) :: get_size => dense_get_size_csp

Return size of specific abstract vector

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

Computes the norm of the abstract_vector.

procedure, public, pass(self) :: rand => dense_rand_csp

Creates a random abstract_vector_csp.

procedure, public, pass(self) :: scal => dense_scal_csp

Compute the scalar-vector product.

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

Subtracts two abstract_vector, i.e. .

procedure, public, pass(self) :: zero => dense_zero_csp

Sets an abstract_vector_csp to zero.

type, public, extends(abstract_vector_rdp) ::  dense_vector_rdp

Components

Type Visibility Attributes Name Initial
real(kind=dp), public, allocatable :: data(:)
integer, public :: n

Type-Bound Procedures

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

Adds two abstract_vector, i.e. .

procedure, public, pass(self) :: axpby => dense_axpby_rdp

In-place computation of .

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

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

procedure, public, pass(self) :: dot => dense_dot_rdp

Computes the dot product between two abstract_vector_rdp.

procedure, public, pass(self) :: get_size => dense_get_size_rdp

Return size of specific abstract vector

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

Computes the norm of the abstract_vector.

procedure, public, pass(self) :: rand => dense_rand_rdp

Creates a random abstract_vector_rdp.

procedure, public, pass(self) :: scal => dense_scal_rdp

Compute the scalar-vector product.

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

Subtracts two abstract_vector, i.e. .

procedure, public, pass(self) :: zero => dense_zero_rdp

Sets an abstract_vector_rdp to zero.

type, public, extends(abstract_vector_rsp) ::  dense_vector_rsp

Components

Type Visibility Attributes Name Initial
real(kind=sp), public, allocatable :: data(:)
integer, public :: n

Type-Bound Procedures

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

Adds two abstract_vector, i.e. .

procedure, public, pass(self) :: axpby => dense_axpby_rsp

In-place computation of .

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

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

procedure, public, pass(self) :: dot => dense_dot_rsp

Computes the dot product between two abstract_vector_rsp.

procedure, public, pass(self) :: get_size => dense_get_size_rsp

Return size of specific abstract vector

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

Computes the norm of the abstract_vector.

procedure, public, pass(self) :: rand => dense_rand_rsp

Creates a random abstract_vector_rsp.

procedure, public, pass(self) :: scal => dense_scal_rsp

Compute the scalar-vector product.

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

Subtracts two abstract_vector, i.e. .

procedure, public, pass(self) :: zero => dense_zero_rsp

Sets an abstract_vector_rsp to zero.