Bidiagonal Derived Type

type, public :: Bidiagonal

Base type used to define a Bidiagonal matrix of size [n, n] with diagonals given by rank-1 arrays dv (size n) and ev (size n-1).


Constructor

public interface Bidiagonal

This interface provides different methods to construct a Bidiagonal matrix. Only the non-zero elements of are stored, i.e.

if is lower-bidiagonal or

if is upper-bidiagonal.

Warning

By default, the matrix is lower-bidiagonal. To create an upper- bidiagonal, set A%which = "U".

Syntax

  • Construct a Bidiagonal matrix filled with zeros:
   integer, parameter :: n = 100
   type(Bidiagonal) :: A

   A = Bidiagonal(n)
  • Construct a Bidiagonal matrix from rank-1 arrays:
   integer, parameter :: n
   real(dp), allocatable :: ev(:), dv(:)
   type(Bidiagonal) :: A
   integer :: i

   dv = [(i, i=1, n)]; ev = [(2*i, i=1, n)]
   A = Bidiagonal(dv, ev)
  • Construct a Bidiagonal matrix with constant diagonals:
   integer, parameter :: n
   real(dp), parameter :: d = 1.0_dp, e = 2.0_dp
   type(Bidiagonal) :: A

   A = Bidiagonal(d, e, n)

Note

Only double precision is currently supported for this matrix type.

  • private pure module function construct(dv, ev, which) result(A)

    Construct a Bidiagonal matrix from the rank-1 arrays dv and ev.

    Arguments

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

    Bidiagonal elements of the matrix.

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

    Bidiagonal elements of the matrix.

    character(len=1), intent(in), optional :: which

    Whether A is lower- or upper-diagonal.

    Return Value type(Bidiagonal)

    Bidiagonal matrix.

  • private pure module function construct_constant(d, e, n, which) result(A)

    Construct a Bidiagonal matrix with constant diagonal elements.

    Arguments

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

    Bidiagonal elements of the matrix.

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

    Bidiagonal elements of the matrix.

    integer(kind=ilp), intent(in) :: n

    Dimension of the matrix.

    character(len=1), intent(in), optional :: which

    Whether A is lower- or upper-bidiagonal.

    Return Value type(Bidiagonal)

    Symmetric Bidiagonal matrix.

  • private pure module function initialize(n) result(A)

    Construct a Bidiagonal matrix filled with zeros.

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=ilp), intent(in) :: n

    Dimension of the matrix.

    Return Value type(Bidiagonal)

    Symmetric Bidiagonal matrix.