%define OT_SecondOrderModel_doc
"Second order model.

Notes
-----
We consider :math:`X: \Omega \times\cD \mapsto \Rset^d` a multivariate
stochastic process of dimension :math:`d`, where :math:`\omega \in \Omega`
is an event, :math:`\cD` is a domain of :math:`\Rset^n`,
:math:`\vect{t}\in \cD` is a multivariate index and
:math:`X(\omega, \vect{t}) \in \Rset^d`.

We note :math:`X_{\vect{t}}: \Omega \rightarrow \Rset^d` the random variable at
index :math:`\vect{t} \in \cD` defined by
:math:`X_{\vect{t}}(\omega)=X(\omega, \vect{t})` and
:math:`X(\omega): \cD  \mapsto \Rset^d` a realization of the process
:math:`X`, for a given :math:`\omega \in \Omega` defined by
:math:`X(\omega)(\vect{t})=X(\omega, \vect{t})`.

The *SecondOrderModel* class enable to get both spectral information of such process thanks to the :class:`SpectralModel` class and spatial/temporal information using the :class:`CovarianceModel` information.

A SecondOrderModel object can be created only through its derived classes:
:class:`~openturns.ExponentialCauchy`"

%enddef
%feature("docstring") OT::SecondOrderModelImplementation
OT_SecondOrderModel_doc

// ---------------------------------------------------------------------

%define OT_SecondOrderModel_compute_covariance_doc
"Evaluate the covariance function.

Available usages:
    computeCovariance(s, t)

    computeCovariance(tau)

Parameters
----------
s, t : floats or sequence of floats.
    Inputs.
tau : float or sequence of floats.
    Input.

Returns
-------
covariance : CovarianceMatrix
    The evaluation of the covariance function.

Notes
-----
*computeCovariance* evaluates the covariance model
:math:`C : \cD \times \cD \mapsto  \cM_{d \times d}(\Rset)` at
:math:`(s,t)\in \Rset^n`:

.. math::

    C(\vect{s}, \vect{t})=\Expect{(X_{\vect{s}}-m(\vect{s}))\Tr{(X_{\vect{t}}-m(\vect{t}))}}


We note that the first usage calls the second as model is stationary. Thus,
 :math:`C(\vect{s}, \vect{t})` = :math:`C^{stat}(\vect{\tau})` with
 :math:`\vect{\tau}=\vect{s}-\vect{t}`. "

%enddef
%feature("docstring") OT::SecondOrderModelImplementation::computeCovariance
OT_SecondOrderModel_compute_covariance_doc

// ---------------------------------------------------------------------

%define OT_SecondOrderModel_compute_spectral_density_doc
"Evaluate the spectral density function for a specific frequency.

Parameters
----------
f : float
    Frequency value.

Returns
-------
spd : HermitianMatrixs
    The evaluation of spectral density function at frequency f.

Notes
-----
*computeSpectralDensity* evaluates the spectral model :math:`S : \Rset^n \mapsto  \cH^+_{d}` at :math:`f\in \Rset^n`:

.. math::

  \forall \vect{f} \in \Rset^n, \cS(\vect{f}) = \prod_{k=1}^{n} \vect{\theta}_k \mat{\Sigma} \rho(\vect{f} \odot \vect{\theta})

where :math:`\mat{\Sigma}` is a covariance matrix that explains the covariance structure and
:math:`(\vect{f} \odot \vect{\theta})_k = \vect{f}_k \vect{\theta}_k`"

%enddef
%feature("docstring") OT::SecondOrderModelImplementation::computeSpectralDensity
OT_SecondOrderModel_compute_spectral_density_doc

// ---------------------------------------------------------------------

%define OT_SecondOrderModel_discretize_doc
"Discretize the second order  on a given RegularGrid/Mesh model using its covariance function.

Parameters
----------
meshOrGrid : :class:`~openturns.Mesh` or :class:`~openturns.RegularGrid`
    Mesh or time grid of size :math:`N` associated with the process.

Returns
-------
covarianceMatrix : :class:`~openturns.CovarianceMatrix`
    Covariance matrix :math:`\in\cM_{nd\times nd}(\Rset)` (if the process is of
    dimension :math:`d`).

Notes
-----
This method makes a discretization of the covariance model on *meshOrGrid* composed of
the vertices :math:`(\vect{t}_1, \dots, \vect{t}_{N-1})` and returns the
covariance matrix:

.. math ::

    \mat{C}_{1,\dots,k} = \left(
        \begin{array}{cccc}
        C(\vect{t}_1, \vect{t}_1) &C(\vect{t}_1, \vect{t}_2) & \dots & C(\vect{t}_1, \vect{t}_{k}) \\
        \dots & C(\vect{t}_2, \vect{t}_2)  & \dots & C(\vect{t}_2, \vect{t}_{k}) \\
        \dots & \dots & \dots & \dots \\
        \dots & \dots & \dots & C(\vect{t}_{k}, \vect{t}_{k})
        \end{array} \right)"
%enddef
%feature("docstring") OT::SecondOrderModelImplementation::discretize
OT_SecondOrderModel_discretize_doc

// ---------------------------------------------------------------------

%define OT_SecondOrderModel_get_covariance_model_doc
"Return the covariance model.

Returns
-------
covarianceModel : :class:`~openturns.CovarianceModel`
    The covariance model of the second order model."
%enddef
%feature("docstring") OT::SecondOrderModelImplementation::getCovarianceModel
OT_SecondOrderModel_get_covariance_model_doc

// ---------------------------------------------------------------------

%define OT_SecondOrderModel_getDimension_doc
"Get the dimension of the *SecondOrderModel*.

Returns
-------
dimension : int
    Dimension of the *SecondOrderModel*."
%enddef
%feature("docstring") OT::SecondOrderModelImplementation::getDimension
OT_SecondOrderModel_getDimension_doc

// ---------------------------------------------------------------------

%define OT_SecondOrderModel_get_spatial_dimension_doc
"Get the spatial dimension of the spectral density function.

Returns
-------
spatialDimension : int
    SpatialDimension of the *SecondOrderModel*."

%enddef
%feature("docstring") OT::SecondOrderModelImplementation::getSpatialDimension
OT_SecondOrderModel_get_spatial_dimension_doc

// ---------------------------------------------------------------------

%define OT_SecondOrderModel_get_spectral_model_doc
"Return the spectral model.

Returns
-------
spectralModel : :class:`~openturns.SpectralModel`
    The spectral model of the second order model."
%enddef
%feature("docstring") OT::SecondOrderModelImplementation::getSpectralModel
OT_SecondOrderModel_get_spectral_model_doc

// ---------------------------------------------------------------------

%define OT_SecondOrderModel_set_models_doc
"Set both the covariance and spectral models of a second order model.

Parameters
----------
covarianceModel : :class:`~openturns.CovarianceModel`
    The covariance model of the second order model.
spectralModel : :class:`~openturns.SpectralModel`
    The spectral model of the second order model."

%enddef
%feature("docstring") OT::SecondOrderModelImplementation::setModels
OT_SecondOrderModel_set_models_doc

// ---------------------------------------------------------------------
