![]() |
(git:3f0d10b)
|
Basic linear algebra operations for complex full matrices. More...
Data Types | |
| interface | cp_cfm_scale |
Functions/Subroutines | |
| subroutine, public | cp_cfm_det (matrix_a, det_a) |
| Computes the determinant (with a correct sign even in parallel environment!) of a complex square matrix. | |
| subroutine, public | cp_cfm_schur_product (matrix_a, matrix_b, matrix_c) |
| Computes the element-wise (Schur) product of two matrices: C = A \circ B . | |
| subroutine, public | cp_cfm_schur_product_cc (matrix_a, matrix_b, matrix_c) |
| Computes the element-wise (Schur) product of two matrices: C = A \circ conjg(B) . | |
| subroutine, public | cp_cfm_scale_and_add (alpha, matrix_a, beta, matrix_b) |
| Scale and add two BLACS matrices (a = alpha*a + beta*b). | |
| subroutine, public | cp_cfm_scale_and_add_fm (alpha, matrix_a, beta, matrix_b) |
| Scale and add two BLACS matrices (a = alpha*a + beta*b). where b is a real matrix (adapted from cp_cfm_scale_and_add). | |
| subroutine, public | cp_cfm_lu_decompose (matrix_a, determinant) |
| Computes LU decomposition of a given matrix. | |
| subroutine, public | cp_cfm_gemm (transa, transb, m, n, k, alpha, matrix_a, matrix_b, beta, matrix_c, a_first_col, a_first_row, b_first_col, b_first_row, c_first_col, c_first_row) |
| Performs one of the matrix-matrix operations: matrix_c = alpha * op1( matrix_a ) * op2( matrix_b ) + beta*matrix_c. | |
| subroutine, public | cp_cfm_column_scale (matrix_a, scaling, first_col, source) |
| Scales columns of the full matrix by corresponding factors. | |
| subroutine, public | cp_cfm_solve (matrix_a, general_a, determinant) |
| Solve the system of linear equations A*b=A_general using LU decomposition. Pay attention that both matrices are overwritten on exit and that the result is stored into the matrix 'general_a'. | |
| subroutine, public | cp_cfm_lu_invert (matrix, info_out) |
| Inverts a matrix using LU decomposition. The input matrix will be overwritten. | |
| subroutine, public | cp_cfm_trace (matrix_a, matrix_b, trace, conjugate_a, local) |
| By default, returns the trace of matrix_a^T matrix_b, i.e sum_{i,j}(matrix_a(i,j)*matrix_b(i,j)) . | |
| subroutine, public | cp_cfm_triangular_multiply (triangular_matrix, matrix_b, side, transa_tr, invert_tr, uplo_tr, unit_diag_tr, n_rows, n_cols, alpha) |
| Multiplies in place by a triangular matrix: matrix_b = alpha op(triangular_matrix) matrix_b or (if side='R') matrix_b = alpha matrix_b op(triangular_matrix) op(triangular_matrix) is: triangular_matrix (if transa="N" and invert_tr=.false.) triangular_matrix^T (if transa="T" and invert_tr=.false.) triangular_matrix^H (if transa="C" and invert_tr=.false.) triangular_matrix^(-1) (if transa="N" and invert_tr=.true.) triangular_matrix^(-T) (if transa="T" and invert_tr=.true.) triangular_matrix^(-H) (if transa="C" and invert_tr=.true.). | |
| subroutine, public | cp_cfm_triangular_invert (matrix_a, uplo, info_out) |
| Inverts a triangular matrix. | |
| subroutine, public | cp_cfm_transpose (matrix, trans, matrixt) |
| Transposes a BLACS distributed complex matrix. | |
| real(kind=dp) function, public | cp_cfm_norm (matrix, mode) |
| Norm of matrix using (p)zlange. | |
| subroutine, public | cp_cfm_rot_rows (matrix, irow, jrow, cs, sn) |
| Applies a planar rotation defined by cs and sn to the i'th and j'th rows. | |
| subroutine, public | cp_cfm_rot_cols (matrix, icol, jcol, cs, sn) |
| Applies a planar rotation defined by cs and sn to the i'th and j'th columnns. | |
| subroutine, public | cp_cfm_uplo_to_full (matrix, workspace, uplo) |
| ... | |
| subroutine, public | cp_cfm_vectorsnorm (matrix, norm_array, squared) |
| find the norm of each column norm_{j}= sqrt( \sum_{i} A_{ij}*conjg(A_{ij}) ) Complex-valued mirror of cp_fm_vectorsnorm. | |
| subroutine, public | cp_cfm_add_on_diag (matrix, alpha, n_active) |
| Adds a scalar to the diagonal of a distributed complex full matrix. | |
| subroutine, public | cp_cfm_get_diag (matrix, diag, n_active) |
| returns the diagonal of a complex full matrix: diag(i)= A_{ii}. Each diagonal entry is owned by one process. The sum over the process grid collects the entries. | |
Basic linear algebra operations for complex full matrices.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_det | ( | type(cp_cfm_type), intent(in) | matrix_a, |
| complex(kind=dp), intent(out) | det_a ) |
Computes the determinant (with a correct sign even in parallel environment!) of a complex square matrix.
| matrix_a | ... |
| det_a | ... |
Definition at line 78 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_schur_product | ( | type(cp_cfm_type), intent(in) | matrix_a, |
| type(cp_cfm_type), intent(in) | matrix_b, | ||
| type(cp_cfm_type), intent(in) | matrix_c ) |
Computes the element-wise (Schur) product of two matrices: C = A \circ B .
| matrix_a | the first input matrix |
| matrix_b | the second input matrix |
| matrix_c | matrix to store the result |
Definition at line 156 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_schur_product_cc | ( | type(cp_cfm_type), intent(in) | matrix_a, |
| type(cp_cfm_type), intent(in) | matrix_b, | ||
| type(cp_cfm_type), intent(in) | matrix_c ) |
Computes the element-wise (Schur) product of two matrices: C = A \circ conjg(B) .
| matrix_a | the first input matrix |
| matrix_b | the second input matrix |
| matrix_c | matrix to store the result |
Definition at line 194 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_scale_and_add | ( | complex(kind=dp), intent(in) | alpha, |
| type(cp_cfm_type), intent(in) | matrix_a, | ||
| complex(kind=dp), intent(in), optional | beta, | ||
| type(cp_cfm_type), intent(in), optional | matrix_b ) |
Scale and add two BLACS matrices (a = alpha*a + beta*b).
| alpha | ... |
| matrix_a | ... |
| beta | ... |
| matrix_b | ... |
Definition at line 243 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_scale_and_add_fm | ( | complex(kind=dp), intent(in) | alpha, |
| type(cp_cfm_type), intent(in) | matrix_a, | ||
| complex(kind=dp), intent(in) | beta, | ||
| type(cp_fm_type), intent(in) | matrix_b ) |
Scale and add two BLACS matrices (a = alpha*a + beta*b). where b is a real matrix (adapted from cp_cfm_scale_and_add).
| alpha | ... |
| matrix_a | ... |
| beta | ... |
| matrix_b | ... |
Definition at line 352 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_lu_decompose | ( | type(cp_cfm_type), intent(in) | matrix_a, |
| complex(kind=dp), intent(out) | determinant ) |
Computes LU decomposition of a given matrix.
| matrix_a | full matrix |
| determinant | determinant |
Definition at line 457 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_gemm | ( | character(len=1), intent(in) | transa, |
| character(len=1), intent(in) | transb, | ||
| integer, intent(in) | m, | ||
| integer, intent(in) | n, | ||
| integer, intent(in) | k, | ||
| complex(kind=dp), intent(in) | alpha, | ||
| type(cp_cfm_type), intent(in) | matrix_a, | ||
| type(cp_cfm_type), intent(in) | matrix_b, | ||
| complex(kind=dp), intent(in) | beta, | ||
| type(cp_cfm_type), intent(inout) | matrix_c, | ||
| integer, intent(in), optional | a_first_col, | ||
| integer, intent(in), optional | a_first_row, | ||
| integer, intent(in), optional | b_first_col, | ||
| integer, intent(in), optional | b_first_row, | ||
| integer, intent(in), optional | c_first_col, | ||
| integer, intent(in), optional | c_first_row ) |
Performs one of the matrix-matrix operations: matrix_c = alpha * op1( matrix_a ) * op2( matrix_b ) + beta*matrix_c.
| transa | form of op1( matrix_a ): op1( matrix_a ) = matrix_a, when transa == 'N' , op1( matrix_a ) = matrix_a^T, when transa == 'T' , op1( matrix_a ) = matrix_a^H, when transa == 'C' , |
| transb | form of op2( matrix_b ) |
| m | number of rows of the matrix op1( matrix_a ) |
| n | number of columns of the matrix op2( matrix_b ) |
| k | number of columns of the matrix op1( matrix_a ) as well as number of rows of the matrix op2( matrix_b ) |
| alpha | scale factor |
| matrix_a | matrix A |
| matrix_b | matrix B |
| beta | scale factor |
| matrix_c | matrix C |
| a_first_col | (optional) the first column of the matrix_a to multiply |
| a_first_row | (optional) the first row of the matrix_a to multiply |
| b_first_col | (optional) the first column of the matrix_b to multiply |
| b_first_row | (optional) the first row of the matrix_b to multiply |
| c_first_col | (optional) the first column of the matrix_c |
| c_first_row | (optional) the first row of the matrix_c |
Definition at line 560 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_column_scale | ( | type(cp_cfm_type), intent(inout) | matrix_a, |
| complex(kind=dp), dimension(:), intent(in) | scaling, | ||
| integer, intent(in), optional | first_col, | ||
| type(cp_cfm_type), intent(in), optional | source ) |
Scales columns of the full matrix by corresponding factors.
| matrix_a | target matrix; columns outside the selected window are unchanged |
| scaling | factors for consecutive columns starting at first_col; the window is truncated at the last global column of the matrix |
| first_col | first global column to scale (defaults to 1) |
| source | optional source with the same shape and distribution as matrix_a; if omitted, matrix_a is scaled in place |
Definition at line 634 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_solve | ( | type(cp_cfm_type), intent(in) | matrix_a, |
| type(cp_cfm_type), intent(in) | general_a, | ||
| complex(kind=dp), optional | determinant ) |
Solve the system of linear equations A*b=A_general using LU decomposition. Pay attention that both matrices are overwritten on exit and that the result is stored into the matrix 'general_a'.
| matrix_a | matrix A (overwritten on exit) |
| general_a | (input) matrix A_general, (output) matrix B |
| determinant | (optional) determinant |
Definition at line 734 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_lu_invert | ( | type(cp_cfm_type), intent(in) | matrix, |
| integer, intent(out), optional | info_out ) |
Inverts a matrix using LU decomposition. The input matrix will be overwritten.
| matrix | input a general square non-singular matrix, outputs its inverse |
| info_out | optional, if present outputs the info from (p)zgetri |
Definition at line 826 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_trace | ( | type(cp_cfm_type), intent(in) | matrix_a, |
| type(cp_cfm_type), intent(in) | matrix_b, | ||
| complex(kind=dp), intent(out) | trace, | ||
| logical, intent(in), optional | conjugate_a, | ||
| logical, intent(in), optional | local ) |
By default, returns the trace of matrix_a^T matrix_b, i.e sum_{i,j}(matrix_a(i,j)*matrix_b(i,j)) .
| matrix_a | a complex matrix |
| matrix_b | another complex matrix |
| trace | value of the trace operator |
| conjugate_a | conjugate the first matrix for a Hermitian Frobenius inner product (default: false) |
| local | return only the local contribution, leaving the reduction to the caller (default: false) |
Definition at line 913 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_triangular_multiply | ( | type(cp_cfm_type), intent(in) | triangular_matrix, |
| type(cp_cfm_type), intent(in) | matrix_b, | ||
| character, intent(in), optional | side, | ||
| character, intent(in), optional | transa_tr, | ||
| logical, intent(in), optional | invert_tr, | ||
| character, intent(in), optional | uplo_tr, | ||
| logical, intent(in), optional | unit_diag_tr, | ||
| integer, intent(in), optional | n_rows, | ||
| integer, intent(in), optional | n_cols, | ||
| complex(kind=dp), intent(in), optional | alpha ) |
Multiplies in place by a triangular matrix: matrix_b = alpha op(triangular_matrix) matrix_b or (if side='R') matrix_b = alpha matrix_b op(triangular_matrix) op(triangular_matrix) is: triangular_matrix (if transa="N" and invert_tr=.false.) triangular_matrix^T (if transa="T" and invert_tr=.false.) triangular_matrix^H (if transa="C" and invert_tr=.false.) triangular_matrix^(-1) (if transa="N" and invert_tr=.true.) triangular_matrix^(-T) (if transa="T" and invert_tr=.true.) triangular_matrix^(-H) (if transa="C" and invert_tr=.true.).
| triangular_matrix | the triangular matrix that multiplies the other |
| matrix_b | the matrix that gets multiplied and stores the result |
| side | on which side of matrix_b stays op(triangular_matrix) (defaults to 'L') |
| transa_tr | ... |
| invert_tr | if the triangular matrix should be inverted (defaults to false) |
| uplo_tr | if triangular_matrix is stored in the upper ('U') or lower ('L') triangle (defaults to 'U') |
| unit_diag_tr | if the diagonal elements of triangular_matrix should be assumed to be 1 (defaults to false) |
| n_rows | the number of rows of the result (defaults to size(matrix_b,1)) |
| n_cols | the number of columns of the result (defaults to size(matrix_b,2)) |
| alpha | ... |
Definition at line 982 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_triangular_invert | ( | type(cp_cfm_type), intent(in) | matrix_a, |
| character, intent(in), optional | uplo, | ||
| integer, intent(out), optional | info_out ) |
Inverts a triangular matrix.
| matrix_a | ... |
| uplo | ... |
| info_out | ... |
Definition at line 1066 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_transpose | ( | type(cp_cfm_type), intent(in) | matrix, |
| character, intent(in) | trans, | ||
| type(cp_cfm_type), intent(in) | matrixt ) |
Transposes a BLACS distributed complex matrix.
| matrix | input matrix |
| trans | 'T' for transpose, 'C' for Hermitian conjugate |
| matrixt | output matrix |
Definition at line 1116 of file cp_cfm_basic_linalg.F.
| real(kind=dp) function, public cp_cfm_basic_linalg::cp_cfm_norm | ( | type(cp_cfm_type), intent(in) | matrix, |
| character, intent(in) | mode ) |
Norm of matrix using (p)zlange.
| matrix | input a general matrix |
| mode | 'M' max abs element value, '1' or 'O' one norm, i.e. maximum column sum, 'I' infinity norm, i.e. maximum row sum, 'F' or 'E' Frobenius norm, i.e. sqrt of sum of all squares of elements |
Definition at line 1191 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_rot_rows | ( | type(cp_cfm_type), intent(in) | matrix, |
| integer, intent(in) | irow, | ||
| integer, intent(in) | jrow, | ||
| real(dp), intent(in) | cs, | ||
| real(dp), intent(in) | sn ) |
Applies a planar rotation defined by cs and sn to the i'th and j'th rows.
| matrix | ... |
| irow | ... |
| jrow | ... |
| cs | cosine of the rotation angle |
| sn | sinus of the rotation angle |
Definition at line 1262 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_rot_cols | ( | type(cp_cfm_type), intent(in) | matrix, |
| integer, intent(in) | icol, | ||
| integer, intent(in) | jcol, | ||
| real(dp), intent(in) | cs, | ||
| real(dp), intent(in) | sn ) |
Applies a planar rotation defined by cs and sn to the i'th and j'th columnns.
| matrix | ... |
| icol | ... |
| jcol | ... |
| cs | cosine of the rotation angle |
| sn | sinus of the rotation angle |
Definition at line 1309 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_uplo_to_full | ( | type(cp_cfm_type), intent(in) | matrix, |
| type(cp_cfm_type), intent(in), optional | workspace, | ||
| character, intent(in), optional | uplo ) |
...
| matrix | ... |
| workspace | ... |
| uplo | triangular format; defaults to 'U' |
Definition at line 1356 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_vectorsnorm | ( | type(cp_cfm_type), intent(in) | matrix, |
| real(kind=dp), dimension(:), intent(out) | norm_array, | ||
| logical, intent(in), optional | squared ) |
find the norm of each column norm_{j}= sqrt( \sum_{i} A_{ij}*conjg(A_{ij}) ) Complex-valued mirror of cp_fm_vectorsnorm.
| matrix | ... |
| norm_array | ... |
| squared | return squared norms instead (default: false) |
Definition at line 1419 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_add_on_diag | ( | type(cp_cfm_type), intent(inout) | matrix, |
| complex(kind=dp), intent(in) | alpha, | ||
| integer, intent(in), optional | n_active ) |
Adds a scalar to the diagonal of a distributed complex full matrix.
| matrix | input/output matrix |
| alpha | scalar added to each diagonal element |
| n_active | optional number of physical rows/columns |
Definition at line 1472 of file cp_cfm_basic_linalg.F.
| subroutine, public cp_cfm_basic_linalg::cp_cfm_get_diag | ( | type(cp_cfm_type), intent(in) | matrix, |
| complex(kind=dp), dimension(:), intent(out) | diag, | ||
| integer, intent(in), optional | n_active ) |
returns the diagonal of a complex full matrix: diag(i)= A_{ii}. Each diagonal entry is owned by one process. The sum over the process grid collects the entries.
| matrix | ... |
| diag | ... |
| n_active | optional number of leading diagonal elements to return |
Definition at line 1526 of file cp_cfm_basic_linalg.F.