This module implements standard operations from linear algebra, including including matrix construction, inversion, commutation, and taking traces.
Constructs an n×n identity matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n |
Matrix dimension |
Identity matrix [n×n]
Wrapper for matrix_inverse_cx that operates on real matrices.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:, :) | :: | A |
Matrix A [n×n] |
Matrix R=A¯¹
Inverts a square matrix via Gauss-Jordan elimination with partial pivot (general) or a cofactoring algorithm (2x2 matrices). The implementation is based on Algorithm #2 in "Efficient matrix inversion via Gauss-Jordan elimination and its parallelization" by E.S. Quintana et al. (1998).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=wp), | intent(in), | dimension(:, :) | :: | A |
Matrix A [n×n] |
Matrix R=A¯¹
Calculates the trace of a general complex matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=wp), | intent(in), | dimension(:, :) | :: | A |
Matrix [n×m] |
r = Tr(A)
Calculates the commutator between two complex square matrices.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=wp), | intent(in), | dimension(:, :) | :: | A |
Left matrix [n×n] |
|
complex(kind=wp), | intent(in), | dimension(size(A, 1), size(A, 1)) | :: | B |
Right matrix [n×n] |
Commutator R = [A,B]
Calculates the anticommutator between two complex square matrices.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=wp), | intent(in), | dimension(:, :) | :: | A |
Left matrix [n×n] |
|
complex(kind=wp), | intent(in), | dimension(size(A, 1), size(A, 1)) | :: | B |
Right matrix [n×n] |
Anticommutator R = {A,B}
Extracts the diagonal of a general complex matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=wp), | intent(in), | dimension(:, :) | :: | A |
Matrix [n×m] |
r = Diag(A)
Constructs a block-diagonal matrix R from two general matrices A and B.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=wp), | intent(in), | dimension(:, :) | :: | A |
Left matrix [n×m] |
|
complex(kind=wp), | intent(in), | dimension(:, :) | :: | B |
Right matrix [p×q] |
R = Diag(A,B)