Documentation for module cp_cfm_types

Represents a complex full matrix distributed on many processors.

source: cp_cfm_types.F
Loading...

public Types:

cp_cfm_type
Represent a complex full matrix.
cp_cfm_p_type
Just to build arrays of pointers to matrices.
copy_cfm_info_type
Stores the state of a copy between cp_cfm_start_copy_general and cp_cfm_finish_copy_general.

Generic procedures:

cp_cfm_to_cfm

public Subroutines/Functions:

Complete the copy operation: wait for comms clean up MPI state.
Creates a new full matrix with the given structure.
Complete the copy operation: wait for comms, unpack, clean up MPI state.
Get the matrix element by its global index.
Returns information about a full matrix.
Extract a sub-matrix from the full matrix: op(target_m)(1:n_rows,1:n_cols) = fm(start_row:start_row+n_rows,start_col:start_col+n_cols). Sub-matrix 'target_m' is replicated on each CPU. Using this call is expensive.
SUBROUTINE
cp_cfm_release (matrix)
Releases a full matrix.
SUBROUTINE
cp_cfm_retain (matrix)
Retains a full matrix.
Set all elements of the full matrix to alpha. Besides, set all diagonal matrix elements to beta (if given explicitly).
Set the matrix element (irow_global,icol_global) of the full matrix to alpha.
Set a sub-matrix of the full matrix: matrix(start_row:start_row+n_rows,start_col:start_col+n_cols) = alpha*op(new_values)(1:n_rows,1:n_cols) + beta*matrix(start_row:start_row+n_rows,start_col:start_col+n_cols)
Initiate the copy operation: get distribution data, post MPI isend and irecvs.
Copy real and imaginary parts of a complex full matrix into separate real-value full matrices.
Construct a complex full matrix by taking its real and imaginary parts from two separate real-value full matrices.

public Types:

TYPE :: copy_cfm_info_type

Stores the state of a copy between cp_cfm_start_copy_general and cp_cfm_finish_copy_general.


INTEGER
:: send_size ...
INTEGER,
DIMENSION(2) :: nlocal_recv ...
INTEGER,
DIMENSION(2) :: nblock_src ...
INTEGER,
DIMENSION(2) :: src_num_pe ...
INTEGER,
ALLOCATABLE, DIMENSION(:) :: recv_disp ...
INTEGER,
ALLOCATABLE, DIMENSION(:) :: recv_request ...
INTEGER,
ALLOCATABLE, DIMENSION(:) :: send_request ...
INTEGER,
DIMENSION(:), POINTER :: recv_col_indices ...
INTEGER,
DIMENSION(:), POINTER :: recv_row_indices ...
INTEGER,
ALLOCATABLE, DIMENSION(:,:) :: src_blacs2mpi ...
COMPLEX(dp),
ALLOCATABLE, DIMENSION(:) :: recv_buf ...
COMPLEX(dp),
ALLOCATABLE, DIMENSION(:) :: send_buf ...

TYPE :: cp_cfm_p_type

Just to build arrays of pointers to matrices.


POINTER :: matrix the pointer to the matrix

TYPE :: cp_cfm_type

Represent a complex full matrix.


CHARACTER(60)
:: name the name of the matrix, used for printing
INTEGER
:: id_nr identification number that makes this matrix unique
INTEGER
:: ref_count ...
INTEGER
:: print_count sequential number to make the printed files unique
POINTER :: matrix_struct structure of this matrix
COMPLEX(dp),
DIMENSION(:,:), POINTER :: local_data array with the data of the matrix (its content depends on the matrix type used: in parallel run it will be in ScaLAPACK format, in sequential run it will simply contain the matrix)


Generic procedure cp_cfm_to_cfm

...

POINTER
:: source ×
POINTER
:: destination ×
POINTER
:: msource ×
POINTER
:: mtarget ×
INTEGER,
INTENT(in)
:: ncol ×
INTEGER,
INTENT(in),
OPTIONAL
:: source_start ×
INTEGER,
INTENT(in),
OPTIONAL
:: target_start ×

SUBROUTINEcp_cfm_cleanup_copy_general(source, info)

Complete the copy operation: wait for comms clean up MPI state.

Arguments:
POINTER
:: source cfm matrix
INTENT(inout)
:: info all of the data that will be needed to complete the copy operation

SUBROUTINEcp_cfm_create(matrix, matrix_struct, name)

Creates a new full matrix with the given structure.

Arguments:
POINTER
:: matrix matrix to be created
POINTER
:: matrix_struct structure of the matrix
CHARACTER(*),
INTENT(in),
OPTIONAL
:: name name of the matrix

SUBROUTINEcp_cfm_finish_copy_general(destination, info)

Complete the copy operation: wait for comms, unpack, clean up MPI state.

Arguments:
POINTER
:: destination output cfm matrix
INTENT(inout)
:: info all of the data that will be needed to complete the copy operation

SUBROUTINEcp_cfm_get_element(matrix, irow_global, icol_global, alpha)

Get the matrix element by its global index.

Arguments:
POINTER
:: matrix full matrix
INTEGER,
INTENT(in)
:: irow_global global row index
INTEGER,
INTENT(in)
:: icol_global global column index
COMPLEX(dp),
INTENT(out)
:: alpha matrix element

SUBROUTINEcp_cfm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, matrix_struct, para_env)

Returns information about a full matrix.

Arguments:
POINTER
:: matrix matrix
CHARACTER(*),
INTENT(out),
OPTIONAL
:: name name of the matrix
INTEGER,
INTENT(out),
OPTIONAL
:: nrow_global total number of rows
INTEGER,
INTENT(out),
OPTIONAL
:: ncol_global total number of columns
INTEGER,
INTENT(out),
OPTIONAL
:: nrow_block number of rows per ScaLAPACK block
INTEGER,
INTENT(out),
OPTIONAL
:: ncol_block number of columns per ScaLAPACK block
INTEGER,
INTENT(out),
OPTIONAL
:: nrow_local number of locally stored rows
INTEGER,
INTENT(out),
OPTIONAL
:: ncol_local number of locally stored columns
INTEGER,
OPTIONAL, POINTER
:: row_indices(:) global indices of locally stored rows
INTEGER,
OPTIONAL, POINTER
:: col_indices(:) global indices of locally stored columns
COMPLEX(dp),
POINTER, OPTIONAL
:: local_data(:,:) locally stored matrix elements
POINTER, OPTIONAL
:: context BLACS context
POINTER, OPTIONAL
:: matrix_struct matrix structure
POINTER, OPTIONAL
:: para_env parallel environment

SUBROUTINEcp_cfm_get_submatrix(fm, target_m, start_row, start_col, n_rows, n_cols, transpose)

Extract a sub-matrix from the full matrix: op(target_m)(1:n_rows,1:n_cols) = fm(start_row:start_row+n_rows,start_col:start_col+n_cols). Sub-matrix 'target_m' is replicated on each CPU. Using this call is expensive.

Arguments:
POINTER
:: fm full matrix you want to get the elements from
COMPLEX(dp),
INTENT(out)
:: target_m(:,:) 2-D array to store the extracted sub-matrix
INTEGER,
INTENT(in),
OPTIONAL
:: start_row global row index of the matrix element target_m(1,1) (defaults to 1)
INTEGER,
INTENT(in),
OPTIONAL
:: start_col global column index of the matrix element target_m(1,1) (defaults to 1)
INTEGER,
INTENT(in),
OPTIONAL
:: n_rows number of rows to extract (defaults to size(op(target_m),1))
INTEGER,
INTENT(in),
OPTIONAL
:: n_cols number of columns to extract (defaults to size(op(target_m),2))
LOGICAL,
INTENT(in),
OPTIONAL
:: transpose indicates that the extracted sub-matrix target_m should be transposed: op(target_m) = target_m^T if .TRUE., op(target_m) = target_m if .FALSE. (defaults to false)

SUBROUTINEcp_cfm_release(matrix)

Releases a full matrix.

Arguments:
POINTER
:: matrix the matrix to release

SUBROUTINEcp_cfm_retain(matrix)

Retains a full matrix.

Arguments:
POINTER
:: matrix the matrix to retain

SUBROUTINEcp_cfm_set_all(matrix, alpha, beta)

Set all elements of the full matrix to alpha. Besides, set all diagonal matrix elements to beta (if given explicitly).

Arguments:
POINTER
:: matrix matrix to initialise
COMPLEX(dp),
INTENT(in)
:: alpha value of off-diagonal matrix elements
COMPLEX(dp),
INTENT(in),
OPTIONAL
:: beta value of diagonal matrix elements (equal to alpha if absent)

SUBROUTINEcp_cfm_set_element(matrix, irow_global, icol_global, alpha)

Set the matrix element (irow_global,icol_global) of the full matrix to alpha.

Arguments:
POINTER
:: matrix full matrix
INTEGER,
INTENT(in)
:: irow_global global row index
INTEGER,
INTENT(in)
:: icol_global global column index
COMPLEX(dp),
INTENT(in)
:: alpha value of the matrix element

SUBROUTINEcp_cfm_set_submatrix(matrix, new_values, start_row, start_col, n_rows, n_cols, alpha, beta, transpose)

Set a sub-matrix of the full matrix: matrix(start_row:start_row+n_rows,start_col:start_col+n_cols) = alpha*op(new_values)(1:n_rows,1:n_cols) + beta*matrix(start_row:start_row+n_rows,start_col:start_col+n_cols)

Arguments:
POINTER
:: matrix full to update
COMPLEX(dp),
INTENT(in)
:: new_values(:,:) replicated 2-D array that holds new elements of the updated sub-matrix
INTEGER,
INTENT(in),
OPTIONAL
:: start_row global row index of the matrix element new_values(1,1) (defaults to 1)
INTEGER,
INTENT(in),
OPTIONAL
:: start_col global column index of the matrix element new_values(1,1) (defaults to 1)
INTEGER,
INTENT(in),
OPTIONAL
:: n_rows number of rows to update (defaults to size(op(new_values),1))
INTEGER,
INTENT(in),
OPTIONAL
:: n_cols number of columns to update (defaults to size(op(new_values),2))
COMPLEX(dp),
INTENT(in),
OPTIONAL
:: alpha scale factor for the new values (defaults to (1.0,0.0))
COMPLEX(dp),
INTENT(in),
OPTIONAL
:: beta scale factor for the old values (defaults to (0.0,0.0))
LOGICAL,
INTENT(in),
OPTIONAL
:: transpose indicates that the matrix new_values should be transposed: op(new_values) = new_values^T if .TRUE., op(new_values) = new_values if .FALSE. (defaults to false)

SUBROUTINEcp_cfm_start_copy_general(source, destination, para_env, info)

Initiate the copy operation: get distribution data, post MPI isend and irecvs.

Arguments:
POINTER
:: source input complex-valued fm matrix
POINTER
:: destination output complex-valued fm matrix
POINTER
:: para_env parallel environment corresponding to the BLACS env that covers all parts of the input and output matrices
INTENT(out)
:: info all of the data that will be needed to complete the copy operation

SUBROUTINEcp_cfm_to_fm(msource, mtargetr, mtargeti)

Copy real and imaginary parts of a complex full matrix into separate real-value full matrices.

Arguments:
POINTER
:: msource complex matrix
TYPE(cp_fm_type),
OPTIONAL, POINTER
:: mtargetr real part of the source matrix
TYPE(cp_fm_type),
OPTIONAL, POINTER
:: mtargeti imaginary part of the source matrix

SUBROUTINEcp_fm_to_cfm(msourcer, msourcei, mtarget)

Construct a complex full matrix by taking its real and imaginary parts from two separate real-value full matrices.

Arguments:
TYPE(cp_fm_type),
OPTIONAL, POINTER
:: msourcer real part of the complex matrix (defaults to 0.0)
TYPE(cp_fm_type),
OPTIONAL, POINTER
:: msourcei imaginary part of the complex matrix (defaults to 0.0)
POINTER
:: mtarget resulting complex matrix

SUBROUTINEcp_cfm_to_cfm_matrix(source, destination)

Copy content of a full matrix into another full matrix of the same size.

Arguments:
POINTER
:: source source matrix
POINTER
:: destination destination matrix

SUBROUTINEcp_cfm_to_cfm_columns(msource, mtarget, ncol, source_start, target_start)

Copy a number of sequential columns of a full matrix into another full matrix.

Arguments:
POINTER
:: msource source matrix
POINTER
:: mtarget destination matrix
INTEGER,
INTENT(in)
:: ncol number of columns to copy
INTEGER,
INTENT(in),
OPTIONAL
:: source_start global index of the first column to copy within the source matrix
INTEGER,
INTENT(in),
OPTIONAL
:: target_start global index of the first column to copy within the destination matrix