svdvals Interface

public interface svdvals

Computes the singular values of a real or complex 2d matrix. (Specification)

Summary

Function interface for computing the array of singular values from the singular value decomposition of a real or complex 2d matrix.

Description

This interface provides methods for computing the singular values a 2d matrix. Supported data types include real and complex. The function returns a real array of singular values, with size [min(m,n)].

Note

The solution is based on LAPACK's singular value decomposition *GESDD methods.

Example

    real(sp) :: a(2,3), s(2)
    a = reshape([3,2, 2,3, 2,-2],[2,3])

    s = svdvals(A)
    print *, 'singular values = ',s

Functions

private module function stdlib_linalg_svdvals_c(a, err) result(s)

Summary

Compute singular values from the singular-value decomposition of a matrix .

Description

This function returns the array of singular values from the singular value decomposition of a real or complex matrix .

param: a Input matrix of size [m,n]. param: err [optional] State return flag.

Return value

param: s real array of size [min(m,n)] returning a list of singular values.

Arguments

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

Input matrix A[m,n]

type(linalg_state_type), intent(out), optional :: err

[optional] state return flag. On error if not requested, the code will stop

Return Value real(kind=sp), allocatable, (:)

Array of singular values

private module function stdlib_linalg_svdvals_d(a, err) result(s)

Summary

Compute singular values from the singular-value decomposition of a matrix .

Description

This function returns the array of singular values from the singular value decomposition of a real or complex matrix .

param: a Input matrix of size [m,n]. param: err [optional] State return flag.

Return value

param: s real array of size [min(m,n)] returning a list of singular values.

Arguments

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

Input matrix A[m,n]

type(linalg_state_type), intent(out), optional :: err

[optional] state return flag. On error if not requested, the code will stop

Return Value real(kind=dp), allocatable, (:)

Array of singular values

private module function stdlib_linalg_svdvals_s(a, err) result(s)

Summary

Compute singular values from the singular-value decomposition of a matrix .

Description

This function returns the array of singular values from the singular value decomposition of a real or complex matrix .

param: a Input matrix of size [m,n]. param: err [optional] State return flag.

Return value

param: s real array of size [min(m,n)] returning a list of singular values.

Arguments

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

Input matrix A[m,n]

type(linalg_state_type), intent(out), optional :: err

[optional] state return flag. On error if not requested, the code will stop

Return Value real(kind=sp), allocatable, (:)

Array of singular values

private module function stdlib_linalg_svdvals_z(a, err) result(s)

Summary

Compute singular values from the singular-value decomposition of a matrix .

Description

This function returns the array of singular values from the singular value decomposition of a real or complex matrix .

param: a Input matrix of size [m,n]. param: err [optional] State return flag.

Return value

param: s real array of size [min(m,n)] returning a list of singular values.

Arguments

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

Input matrix A[m,n]

type(linalg_state_type), intent(out), optional :: err

[optional] state return flag. On error if not requested, the code will stop

Return Value real(kind=dp), allocatable, (:)

Array of singular values