# U_prodRinvA

The page document the user-supplied call-back routine `U_prodRinvA`

.

The routine `U_prodRinvA`

is a call-back routine that has to be provided by the user. In the simplified interface the predefined name of the routine is `prodRinvA_pdaf`

, but in the full interface, the user can choose the name of the routine.
The routine is used with all global filters and called during the analysis step. The purpose of the routine is to compute the product of the inverse of the observation error covariance matrix with some matrix **A** (as **R ^{-1}** x

**A**). The matrix

**A**holds an intermediate computing result of the filter analysis step. For the ESTKF this matrix holds the observed part of the ensemble perturbations. The matrix is provided as

`A_p`

. The product has to be returned in the array `C_p`

.
The interface is the following:

SUBROUTINE U_prodRinvA(step, dim_obs_p, rank, observation_p, A_p, C_p)

with

`step`

:`integer, intent(in)`

Current time step`dim_obs_p`

:`integer, intent(in)`

Number of observations at current time step (i.e. the size of the observation vector)`rank`

:`integer, intent(in)`

Number of the columns in the matrix processes here. This is usually the ensemble size minus one (or the rank of the initial covariance matrix)`obs_p`

:`real, intent(in), dimension(dim_obs_p)`

Vector of observations`A_p`

:`real, intent(in), dimension(dim_obs_p, rank)`

Input matrix provided by PDAF`C_p`

:`real, intent(out), dimension(dim_obs_p, rank)`

Output matrix

Notes:

- In case of a parallelization with domain decomposition,
`A_p`

contains the part of the matrix that resides on the model sub-domain of the calling process. The product has to be computed for this sub-domain, too.

Hints:

- The information about the inverse observation error covariance matrix has to be provided by the user. Possibilities are to read this information from a file, or to use a Fortran module that holds this information, which one could already prepare in init_pdaf.
- The routine does not require that the product is implemented as a real matrix-matrix product. Rather, the product can be implemented in its most efficient form. For example, if the observation error covariance matrix is diagonal, only the multiplication of the inverse diagonal with the matrix
`A_p`

has to be implemented. - The observation vector
`obs_p`

is provided through the interface for cases where the observation error variance is relative to the actual value of the observations. - The interface has a difference for ESTKF and ETKF: For ETKF the value of third argument is the ensemble size (
`dim_ens`

), while for the ESTKF it is`dim_ens-1`

(according to the usual rank (`rank`

) of the covariance matrix. However, the value is given when the routine is called. Thus, the routine just needs to be able to work with the provided value.