# doc-cache created by Octave 5.1.0
# name: cache
# type: cell
# rows: 3
# columns: 61
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
cat_cell_array


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 128
 Concatenate a cell array.

 x = cat_cell_array(c)

 Concatenate all arrays of the cell array c along the dimension length(c)+1



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
 Concatenate a cell array.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
colordisp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 134
 Display a message in a color (followed by a newline).

 colordisp(msg,color)

 The same as disp but in color.

 See also
   colormsg



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
 Display a message in a color (followed by a newline).



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
colormsg


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 383
 Display a message in a color (without a newline).

 colormsg(msg,color)

 The message msg in printed on the terminal the specified color. Acceptable 
 values color color are:
   black  
   red    
   green  
   yellow 
   blue   
   magenta
   cyan   
   white  

 In Matlab the message is displayed in black (due to the lack of ANSI escape 
 code support).

 See also
   colordisp



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
 Display a message in a color (without a newline).



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
conjugategradient


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 440
 Solve a linear system with the preconditioned conjugated-gradient method.

 [x] = conjugategradient(fun,b,tol,maxit,pc,pc2,x0);
 [x,Q,T] = conjugategradient(fun,b,tol,maxit,pc,pc2,x0);

 solves for x
 A x = b
 using the preconditioned conjugated-gradient method.
 It provides also an approximation of A:
 A \sim Q*T*Q'

 J(x) = 1/2 (x' b - x' A x)
 ∇ J = b - A x
 A x = b - ∇ J
 b = ∇ J(0)

 the columns of Q are the Lanczos vectors



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 74
 Solve a linear system with the preconditioned conjugated-gradient method.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
divand


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 4380
 Compute a variational analysis of arbitrarily located observations.

 [fi,err,s] = divand(mask,pmn,xi,x,f,len,lambda,...);
 [fi,err] = divand(mask,pmn,xi,x,f,len,lambda,...);
 [fi,s] = divand(mask,pmn,xi,x,f,len,lambda,...);

 Perform an n-dimensional variational analysis of the observations f located at
 the coordinates x. The array fi represent the interpolated field at the grid
 defined by the coordinates xi and the scales factors pmn.

 Input:
   mask: binary mask delimiting the domain. 1 is inside and 0 outside.
         For oceanographic application, this is the land-sea mask.

   pmn: scale factor of the grid. pmn is a cell array with n elements. Every 
        element represents the scale factor of the corresponding dimension. Its
        inverse is the local resolution of the grid in a particular dimension.

   xi: cell array with n elements. Every element represents a coordinate
   of the final grid on which the observations are interpolated
   x: cell array with n elements. Every element represents a coordinate of
   the observations
   f: value of the observations *minus* the background estimate (m-by-1 array).
     (see note)
   len: correlation length
   lambda: signal-to-noise ratio of observations (if lambda is a scalar).
     The larger this value is, the closer is the field fi to the
     observation.
     if lambda is a scalar:
        R = 1/lambda I, where R is the observation error covariance
        matrix),
     if lambda is a vector
     a vector (R = diag(lambda)) or a matrix or a CovarParam object (R = 
     lambda).


 Optional input arguments specified as pairs of keyword and values:
  'velocity', vel: velocity of advection constraint. The default is 
        no-advection constraint

  'alpha': alpha is vector of coefficients multiplying various terms in the 
        cost function. The first element multiplies the norm.
        The other i-th element of alpha multiplies the (i+1)-th derivative. 
        Per default, the highest derivative is m = ceil(1+n/2) where n is the 
        dimension of the problem.

        The values of alpha is the (m+1)th row of the Pascal triangle:
           m=0         1
           m=1       1   1
           m=1     1   2   1     (n=1,2)
           m=2   1   3   3   1   (n=3,4)
           ...

  'diagnostics': 0 or 1 turns diagnostic and debugging information on (1) or 
        off (0, default). If on, they will be returned as the last output 
        argument

  'EOF', EOF: sub-space constraint. Orthogonal (EOF' WE^2 EOF = I) (units of 
        EOF: m^(-n/2))

  'EOF_scaling', EOF_scaling: (dimensional)

  'constraint': a structure with user specified constrain

  'moddim': modulo for cyclic dimension (vector with n elements). 
      Zero is used for non-cyclic dimensions. Halo points should 
      not be included for cyclic dimensions. For example if the first dimension
      is cyclic, then the grid point corresponding to mask(1,j) should be 
      between mask(end,1) (left neighbor) and mask(2,j) (right neighbor)

  'fracdim': fractional indices (n-by-m array). If this array is specified, 
      then x and xi are not used.

  'inversion': direct solver ('chol' for Cholesky factorization) or a 
      interative solver ('pcg' for preconditioned conjugate gradient) can be 
      used.

  'compPC': function that returns a preconditioner for the primal formulation 
      if inversion is set to 'pcg'. The function has the following arguments:

            [M1,M2] = compPC(iB,H,R)

     where iB is the inverse background error covariance, H the observation 
     operator and R the error covariance of the observation. The used 
     preconditioner M will be M = M1 * M2 (or just M = M1 if M2 is empty).
     Per default a modified incomplete Cholesky factorization will be used a 
     preconditioner.

  Note: 'velocity' and 'constraint' may appear multiple times

 Output:
   fi: the analysed field
   err: error variance of the analysis field relative to the error variance of 
     the background
   s: structure
     s.iB: adimensional
     s.E: scaled EOF (dimensional)

 Note:
   If zero is not a valid first guess for your variable (as it is the case for 
   e.g. ocean temperature), you have to subtract the first guess from the 
   observations before calling divand and then add the first guess back in.

 Example:
   see divand_simple_example.m




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 68
 Compute a variational analysis of arbitrarily located observations.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
divand_addc


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 405
 Add a constraint to the cost function.

 s = divand_addc(s,constrain)

 Include in the structure s the specified constrain. 

 Input:
   s: structure created by divand_background
   constrain: The parameter constrain has the following fields: R (a covariance
     matrix), H (extraction operator) and yo (specified value for the 
     constrain).

 Output:
   s: structure to be used by divand_factorize



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
 Add a constraint to the cost function.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
divand_background


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 833
 Form the inverse of the background error covariance matrix.

 s = divand_background(mask,pmn,Labs,alpha,moddim)

 Form the inverse of the background error covariance matrix with
 finite-difference operators on a curvilinear grid

 Input:
   mask: binary mask delimiting the domain. 1 is inside and 0 outside.
         For oceanographic application, this is the land-sea mask.

   pmn: scale factor of the grid.

   Labs: correlation length

   alpha: a dimensional coefficients for norm, gradient, laplacian,...
      alpha is usually [1 2 1]. 
       

 Output:
   s: stucture containing
   s.iB: inverse of the background error covariance
   s.L: spatial average correlation length
   s.n: number of dimenions
   s.coeff: scaling coefficient such that the background variance
     diag(inv(iB)) is one far away from the boundary.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 60
 Form the inverse of the background error covariance matrix.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 28
divand_background_components


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 297
 Form the different components of the background error covariance matrix.

 [iB_,iB] = divand_background_components(s,alpha)

 Compute the components of the background error covariance matrix iB_ and 
 their sum based on alpha (the a-dimensional coefficients for norm, gradient, 
 laplacian,...).



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
 Form the different components of the background error covariance matrix.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
divand_constr_advec


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 416
 Create the advection constrain.

 c = divand_constr_advec(s,velocity)

 Create the advection constrain using the specified velocity.

 Input:
   s: structure created by divand_background
   velocity: cell array of velocity vectors

 Output:
   c: structure to be used by divand_addc with the following fields: R (a 
     covariance matrix), H (extraction operator) and yo (specified value for 
     the constrain).



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
 Create the advection constrain.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
divand_diagnose


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 320
 Computes diagnostics for the analysis.

 [Jb,Jo,Jeof,J] = divand_diagnose(s,fi,d)

 Computes the value of different terms of the cost-function

 Input:
   s: structure created by divand_solve
   fi: analysis
   d: observations

 Output:
   Jb: background constrain
   Jeof: observation constrain
   Jeof: EOF constrain



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
 Computes diagnostics for the analysis.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
divand_eof_contraint


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 202
 Include constraint from EOFs.

 s = divand_eof_contraint(s,EOF_lambda,EOF)

 Include the constraint from the EOF and their eigenvalues (EOF_lambda)
 in the cost function described by the structure s.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
 Include constraint from EOFs.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
divand_error


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 339
 Compute the expected error variance of the analysis.

 err = divand_error(s)

 Compute the expected error variance of the analysis based on the
 background error covariance, observation error covariance and data
 distribution.

 Input:
   s: structure created by divand_factorize

 Output:
   err: expected error variance of the analysis



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
 Compute the expected error variance of the analysis.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
divand_factorize


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 233
 Factorize some matrices to increase performance.

 s = divand_factorize(s)

 Create the inverse of the posteriori covariance matrix
 and factorize

 Input:
   s: structure created by divand_background

 Output:
   s.P: factorized P



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
 Factorize some matrices to increase performance.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
divand_kernel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 437
 Return the analytical kernel and normalization factor.

 [mu,K] = divand_kernel(n,alpha)
 [mu,K] = divand_kernel(n,alpha,r)

 Analytical (normalized) kernels for infinite domain in dimension n and for 
 coefficients alpha
 Input
   n: number of dimensions
   alpha: coefficients
   r (optional): distance from origin
 Output:
   K: kernel function evaluate at the values of r if present or a function handle
   mu: normalization factor



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
 Return the analytical kernel and normalization factor.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
divand_laplacian


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 513
 Create the laplacian operator.
 
 Lap = divand_laplacian(mask,pmn,nu,iscyclic)

 Form a Laplacian using finite differences
 assumes that gradient is zero at "coastline"

 Input:
   mask: binary mask delimiting the domain. 1 is inside and 0 outside.
         For oceanographic application, this is the land-sea mask.
   pmn: scale factor of the grid. 
   nu: diffusion coefficient of the Laplacian
      field of the size mask or cell arrays of fields

 Output:
   Lap: sparce matrix represeting a Laplaciant 

 



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
 Create the laplacian operator.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
divand_metric


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 261
 Compute metric scale factors.

 [pm,pn] = divand_metric(lon,lat)

 Compute metric scale factors pm and pn based on 
 longitude lon and latitude lat. The variables pm and pn
 represent the inverse of the local resolution in meters using
 the mean Earth radius.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
 Compute metric scale factors.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
divand_obs


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 696
 Include the constrain from the observations.

 s = divand_obs(s,xi,x,lambda,I)

 Set observations of variational problem.
 It is assumed that the each coordinate depends only on one
 index. If this is not the case, then matrix I must be provided.

 Input:
   s: structure created by divand_background
   xi: coordinates of observations*
   x: coordinates of grid*
   lambda: signal-to-noise ratio of observations
   I (optional): fractional indexes of location of observation 
     within the grid

 Output:
   s: structure to be used by divand_factorize

 Note:
   *these parameters can either be specified as a cell
   array of all dimenions:
   xi = {Xi,Yi,Zi}
   or as n+1 dimensional array



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
 Include the constrain from the observations.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
divand_operators


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 652
 Generate the gradient and Laplacian operators.

 s = divand_operators(mask,pmn,nu,iscyclic)

 Form sparse matrixes representing the gradient and Laplacian using
 finite differences

 Input:
   mask: binary mask delimiting the domain. 1 is inside and 0 outside.
         For oceanographic application, this is the land-sea mask.
   pmn: scale factor of the grid. 
   nu: diffusion coefficient of the Laplacian

 Output:
   s: stucture containing
   s.Dx: cell array of the gradient
   s.D: Laplaciant
   s.sv: structure describing the state vector
   s.mask: land-sea mask
   s.WE: diagonal matrix where each element is the surface
     of a grid cell



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
 Generate the gradient and Laplacian operators.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 26
divand_orthogonalize_modes


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 297
 Orthogonalize EOF modes.

 [U3,WE] = divand_orthogonalize_mode(mask,pmn,U)

 The modes U are orthogonalized using the mask and metric (pmn). WE is square 
 root of norm. Diagonal of WE.^2 is the surface of corresponding cell (units: 
 m). The output U3 represent the normalized EOFs (units: m-1)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 25
 Orthogonalize EOF modes.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
divand_pc_michol


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 608
 Compute a preconditioner using a modified incomplete Cholesky decomposition.

 [M1,M2] = divand_pc_michol(iB,H,R,icholparam)

 Compute preconditioner matrices M1 and M2 based on
 the inverse background error covariance iB, observation operator
 H and observation R covariance R. icholparam is a structure will parameters
 for ichol. The default value is struct('michol','on'). A modified incomplete
 Cholesky factorization of the matrix iP = iB + H'*(R\H) is computed per 
 default.
 M2 is the transpose of M1 for this preconditioner.

 The function ichol is necessary.

 See also:
 ichol, divand_pc_sqrtiB



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 77
 Compute a preconditioner using a modified incomplete Cholesky decomposition.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
divand_pc_none


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 184
 No preconditioner is used.

 [M1,M2] = divand_pc_none(iB,H,R)

 Dummy function for requiring that no preconditioner is used in divand.

 See also:
 diavnd_pc_michol, diavnd_pc_sqrtiB



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
 No preconditioner is used.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
divand_pc_sqrtiB


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 308
 Compute a preconditioner using the Cholesky decomposition.

 [M1,M2] = divand_pc_michol(iB,H,R)

 Compute preconditioner matrices M1 and M2 based on
 the Cholesky decomposition of iB. The matrices H and R are not used.
 M2 is the transpose of M1 for this preconditioner.

 See also:
 chol, divand_pc_michol



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 59
 Compute a preconditioner using the Cholesky decomposition.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
divand_realistic_example


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 186
 A realistic example of divand in 2 dimensions
 with salinity observations in the Mediterranean Sea at 30m.

 Data is available at 
 http://modb.oce.ulg.ac.be/mediawiki/index.php/Divand



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 A realistic example of divand in 2 dimensions
 with salinity observations in...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
divand_rms


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 133
 The RMS error between two variables.

 r = divand_rms(x,y,norm)

 Returns rms between x and y (taking norm into account if present)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
 The RMS error between two variables.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
divand_simple_example


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 92
 A simple example of divand in 2 dimensions
 with observations from an analytical function.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 A simple example of divand in 2 dimensions
 with observations from an analyt...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
divand_solve


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 269
 Solve the variational problem.
 
 fi = divand_solve(s,yo)

 Derive the analysis based on all contraints included in s and using the 
 observations yo

 Input:
   s: structure created by divand_factorize
   yo: value of the observations

 Output:
   fi: analyzed field



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
 Solve the variational problem.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
divand_solve_eof


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 451
 Solve the variational problem with the contraints from EOFs.

 [fi,s] = divand_solve_eof(s,yo,EOF_lambda,EOF)

 Derive the analysis based on all contraints included in s and using the 
 observations yo and EOFs

 Input:
   s: structure created by divand_factorize
   yo: value of the observations
   EOF_lambda: weight of each EOF (adimentional)
   EOF: matrix containing the EOFs (units m^(-n/2))

 Output:
   fi: analyzed field
   s.E: scaled EOFs



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
 Solve the variational problem with the contraints from EOFs.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
interp_regular


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 697
 Interpolation matrix for a n-dimensional interpolation.

 [H,out] = interp_regular(mask,x,xi)

 Creates sparse interpolation matrix H for n-dimensional interpolation problem.

 Input:
   mask: binary mask delimiting the domain. 1 is inside and 0 outside.
         For oceanographic application, this is the land-sea mask.
   x: cell array with n elements. Every element represents a coordinate of the 
         observations
   xi: cell array with n elements. Every element represents a coordinate of the
         final grid on which the observations are interpolated.

 Output:
   H: sparse matrix representing the linear interpolation
   out: 1 for each observation out of the grid, 0 otherwise



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
 Interpolation matrix for a n-dimensional interpolation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 21
localize_regular_grid


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 307
 Derive fractional indices on a regular grid.

 I = localize_regular_grid(xi,mask,x)

 Derive fractional indices where xi are the points to localize in the 
 regular grid x (constant increment in all dimension).  
 The output I is an n-by-m array where n number of dimensions and m number of 
 observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
 Derive fractional indices on a regular grid.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 23
localize_separable_grid


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 327
 Derive fractional indices on a separable grid.

 I = localize_separable_grid(xi,mask,x)

 Derive fractional indices where xi are the points to localize in the 
 separable grid x (every dimension in independent on other dimension).  
 The output I is an n-by-m array where n number of dimensions and m number of 
 observations



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
 Derive fractional indices on a separable grid.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
mtimescorr


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 256
 Product between a Gaussian covariance matrix and a vector.

 p = mtimescorr(xi,len,b)

 Compute the product between a Gaussian covariance with a length scale len and
 grid points located in xi and the vector b. The covariance matrix has a unit
 variance.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 59
 Product between a Gaussian covariance matrix and a vector.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
sparse_diag


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 169
 Create diagonal sparse matrix.

 s = sparse_diag(d)

 Create diagonal sparse matrix s based on the diagonal elements d. The 
 parameter d is transformed into a vector.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
 Create diagonal sparse matrix.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
sparse_diff


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 318
 Sparse operator for differentiation.

 diffx = sparse_diff(sz1,m,cyclic)

 Sparse operator for differentiation along dimension m for "collapsed" matrix
 of the size sz1.

 Input:
   sz1: size of rhs
   m: dimension to differentiate
   cyclic: true if domain is cyclic along dimension m. False is the
   default value



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 37
 Sparse operator for differentiation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
sparse_gradient


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 431
 Sparse operator for a gradient.

 [Dx1,Dx2,...,Dxn] = sparse_gradient(mask,pmn)

 Form the gradient using finite differences in all n-dimensions

 Input:
   mask: binary mask delimiting the domain. 1 is inside and 0 outside.
         For oceanographic application, this is the land-sea mask.
 
   pmn: scale factor of the grid. 

 Output:
   Dx1,Dx2,...,Dxn: sparce matrix represeting a gradient along 
     different dimensions 



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
 Sparse operator for a gradient.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
sparse_interp


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 402
 Create a sparse interpolation matrix.

 [H,out] = sparse_interp(mask,I)

 Create interpolation matrix from mask and fractional indexes I

 Input:
   mask: 0 invalid and 1 valid points (n-dimensional array)
   I: fractional indexes (2-dim array n by mi, where mi is the number of points to interpolate)
 Ouput:
   H: sparse matrix with interpolation coefficients 
   out: true if value outside of grid



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
 Create a sparse interpolation matrix.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
sparse_pack


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 193
 Create a sparse matrix which packs an array under the control of a mask.

 H = sparse_pack(mask)

 Create a sparse matrix H which packs an array. It selects the elements where 
 mask is true.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 73
 Create a sparse matrix which packs an array under the control of a mask.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
sparse_shift


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 347
 Sparse operator shifting a field in a given dimension.

 function S = sparse_shift(sz1,m,cyclic)

 Sparse operator shifting a field in the dimension m. The field is a 
 "collapsed" matrix of the size sz1.

 Input:
   sz1: size of rhs
   m: dimension to shift
   cyclic: true if domain is cyclic along dimension m. False is the
     default value



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 55
 Sparse operator shifting a field in a given dimension.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
sparse_stagger


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 327
 Sparse operator for staggering.

 S = sparse_stagger(sz1,m,cyclic)

 Create a sparse operator for staggering a field in dimension m.
 The field is a "collapsed" matrix of the size sz1.

 Input:
   sz1: size of rhs
   m: dimension to stagger
   cyclic: true if domain is cyclic along dimension m. False is the
   default value



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
 Sparse operator for staggering.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
sparse_trim


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 234
 Sparse operator for trimming.

 T = sparse_trim(sz1,m)

 Create a sparse operator which trim first and last row (or column) in 
 The field is a "collapsed" matrix of the size sz1.

 Input:
   sz1: size of rhs
   m: dimension to trim



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
 Sparse operator for trimming.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
statevector_init


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 530
 Initialize structure for packing and unpacking given their mask.

 s = statevector_init(mask1, mask2, ...)

 Initialize structure for packing and unpacking
 multiple variables given their corresponding land-sea mask.

 Input:
   mask1, mask2,...: land-sea mask for variable 1,2,... Sea grid points correspond to one and land grid points to zero.
     Every mask can have a different shape.
 
 Output:
   s: structure to be used with statevector_pack and statevector_unpack.

 Note:
 see also statevector_pack, statevector_unpack



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 65
 Initialize structure for packing and unpacking given their mask.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
statevector_pack


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 712
 Pack a series of variables into a vector under the control of a mask.

 x = statevector_pack(s,var1, var2, ...)

 Pack the different variables var1, var2, ... into the vector x.
 Only sea grid points are retained.

 Input:
   s: structure generated by statevector_init.
   var1, var2,...: variables to pack (with the same shape as the corresponding masks).

 Output:
   x: vector of the packed elements. The size of this vector is the number of elements of all masks equal to 1.

 Notes:
 If var1, var2, ... have an additional trailing dimension, then this dimension is assumed 
 to represent the different ensemble members. In this case x is a matrix and its last dimension
 is the number of ensemble members.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 70
 Pack a series of variables into a vector under the control of a mask.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
statevector_unpack


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 796
 Unpack a vector into different variables under the control of a mask.

 [var1, var2, ...] = statevector_unpack(s,x)
 [var1, var2, ...] = statevector_unpack(s,x,fillvalue)

 Unpack the vector x into the different variables var1, var2, ...

 Input:
   s: structure generated by statevector_init.
   x: vector of the packed elements. The size of this vector is the number of elements equal to 1
     in all masks.

 Optional input parameter:
   fillvalue: The value to fill in var1, var2,... where the masks correspond to a land grid point. The default is zero.

 Output:
   var1, var2,...: unpacked variables.

 Notes:
 If x is a matrix, then the second dimension is assumed 
 to represent the different ensemble members. In this case,
 var1, var2, ... have also an additional trailing dimension.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 70
 Unpack a vector into different variables under the control of a mask.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
test_1dvar


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
 Testing divand in 1 dimension.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 32
 Testing divand in 1 dimension.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
test_2dvar


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
 Testing divand in 2 dimensions.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
 Testing divand in 2 dimensions.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
test_2dvar_adv


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
 Testing divand in 2 dimensions with advection.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
 Testing divand in 2 dimensions with advection.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
test_2dvar_check


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 63
 Testing divand in 2 dimensions with independent verification.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 63
 Testing divand in 2 dimensions with independent verification.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
test_2dvar_check_correrr


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
 Testing divand in 2 dimensions with correlated errors.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 56
 Testing divand in 2 dimensions with correlated errors.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
test_2dvar_constrain


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
 Testing divand in 2 dimensions with a custom constrain.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
 Testing divand in 2 dimensions with a custom constrain.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
test_2dvar_cyclic


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
 Testing divand in 2 dimensions in a cyclic domain.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
 Testing divand in 2 dimensions in a cyclic domain.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
test_2dvar_eof_check


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
 Testing divand in 2 dimensions with EOF constraints.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
 Testing divand in 2 dimensions with EOF constraints.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
test_2dvar_lenxy


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
 Testing divand in 2 dimensions with lenx /= leny.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
 Testing divand in 2 dimensions with lenx /= leny.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
test_2dvar_pcg


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
 Testing divand in 2 dimensions with pcg solver.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
 Testing divand in 2 dimensions with pcg solver.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
test_2dvar_rellen


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
 Testing divand in 2 dimensions with relative correlation length.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 66
 Testing divand in 2 dimensions with relative correlation length.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
test_3dvar


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
 Testing divand in 3 dimensions.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
 Testing divand in 3 dimensions.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 24
test_3dvar_large_stacked


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 97
 Testing divand in 3 dimensions without correlation in the 3rd dimension 
 (vertically stacked).



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 Testing divand in 3 dimensions without correlation in the 3rd dimension 
 (v...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
test_4dvar


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
 Testing divand in 4 dimensions.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
 Testing divand in 4 dimensions.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
test_divand


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
 Test if divand is working correctly.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 38
 Test if divand is working correctly.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
test_interp_1d


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
 Testing 1D linear interpolation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
 Testing 1D linear interpolation.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
test_interp_2d


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
 Testing 2D linear interpolation.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
 Testing 2D linear interpolation.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
test_interp_regular


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
 Testing linear interpolation on regular grid.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 47
 Testing linear interpolation on regular grid.




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
test_sparse_diff


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
 Testing sparse operators.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 27
 Testing sparse operators.






