diag Interface

public interface diag

Public interface for functions that deal with matrix diagonals.


Module Procedures

public pure function matrix_diag(A, B) result(R)

Constructs a block-diagonal matrix R from two general matrices A and B.

Arguments

Type IntentOptional Attributes Name
complex(kind=wp), intent(in), dimension(:, :) :: A

Left matrix [n×m]

complex(kind=wp), intent(in), dimension(:, :) :: B

Right matrix [p×q]

Return Value complex(kind=wp), dimension(size(A, 1) + size(B, 1), size(A, 2) + size(B, 2))

R = Diag(A,B)

public pure function vector_diag(A) result(r)

Extracts the diagonal of a general complex matrix.

Arguments

Type IntentOptional Attributes Name
complex(kind=wp), intent(in), dimension(:, :) :: A

Matrix [n×m]

Return Value complex(kind=wp), dimension(min(size(A, 1), size(A, 2)))

r = Diag(A)