# HODMD¶

Derived module from hankeldmd.py for higher order dmd.

Reference: - S. L Clainche, J. M. Vega, Higher Order Dynamic Mode Decomposition. Journal on Applied Dynamical Systems, 16(2), 882-925, 2017.

 `HODMD.atilde` Get the reduced Koopman operator A, called A tilde. `HODMD.dmd_timesteps` Get the timesteps of the reconstructed states. `HODMD.dynamics` Get the time evolution of each mode. `HODMD.eigs` Get the eigenvalues of A tilde. `HODMD.fit` Compute the Dynamic Modes Decomposition to the input data. `HODMD.modes` Get the matrix containing the DMD modes, stored by column. `HODMD.original_timesteps` Get the timesteps of the original snapshot. `HODMD.plot_eigs` Plot the eigenvalues. `HODMD.plot_modes_2D` Plot the DMD Modes. `HODMD.plot_snapshots_2D` Plot the snapshots. `HODMD.reconstructions_of_timeindex` Build a collection of all the available versions of the given timeindex. `HODMD.reconstructed_data` Get the reconstructed data. `HODMD.snapshots` Get the original input data.
class `HODMD`(svd_rank=0, tlsq_rank=0, exact=False, opt=False, rescale_mode=None, forward_backward=False, d=1, sorted_eigs=False, reconstruction_method='first', svd_rank_extra=0)[source]

Bases: `pydmd.hankeldmd.HankelDMD`

Higher Order Dynamic Mode Decomposition

Parameters
• svd_rank (int or float) – the rank for the truncation; If 0, the method computes the optimal rank and uses it for truncation; if positive interger, the method uses the argument for the truncation; if float between 0 and 1, the rank is the number of the biggest singular values that are needed to reach the ‘energy’ specified by svd_rank; if -1, the method does not compute truncation.

• tlsq_rank (int) – rank truncation computing Total Least Square. Default is 0, that means no truncation.

• exact (bool) – flag to compute either exact DMD or projected DMD. Default is False.

• opt (bool or int) – argument to control the computation of DMD modes amplitudes. See `DMDBase`. Default is False.

• rescale_mode ({'auto'} or None or numpy.ndarray) – Scale Atilde as shown in 10.1016/j.jneumeth.2015.10.010 (section 2.4) before computing its eigendecomposition. None means no rescaling, ‘auto’ means automatic rescaling using singular values, otherwise the scaling factors.

• forward_backward (bool) – If True, the low-rank operator is computed like in fbDMD (reference: https://arxiv.org/abs/1507.02264). Default is False.

• d (int) – the new order for spatial dimension of the input snapshots. Default is 1.

• sorted_eigs ({'real', 'abs'} or False) – Sort eigenvalues (and modes/dynamics accordingly) by magnitude if sorted_eigs=’abs’, by real part (and then by imaginary part to break ties) if sorted_eigs=’real’. Default: False.

• reconstruction_method – Method used to reconstruct the snapshots of the dynamical system from the multiple versions available due to how HODMD is conceived. If ‘first’ (default) the first version available is selected (i.e. the nearest to the 0-th row in the augmented matrix). If ‘mean’ we compute the element-wise mean. If reconstruction_method is an array of float values we compute the weighted average (for each snapshots) using the given values as weights (the number of weights must be equal to d).

• svd_rank_extra – the rank for the initial reduction of the input data, performed before the rearrangement of the input data to the (pseudo) Hankel matrix format; If 0, the method computes the optimal rank and uses it for truncation; if positive interger, the method uses the argument for the truncation; if float between 0 and 1, the rank is the number of the biggest singular values that are needed to reach the ‘energy’ specified by svd_rank; if -1, the method does not compute truncation.

`fit`(X)[source]

Compute the Dynamic Modes Decomposition to the input data.

Parameters

X (numpy.ndarray or iterable) – the input snapshots.

`reconstructions_of_timeindex`(timeindex=None)[source]

Build a collection of all the available versions of the given timeindex. The indexing of time instants is the same used for `reconstructed_data()`. For each time instant there are at least one and at most d versions. If timeindex is None the function returns the whole collection, for all the time instants.

Parameters

timeindex (int) – The index of the time snapshot.

Returns

A collection of all the available versions for the requested time instants, represented by a matrix (or tensor). Axes: 0. Number of time instants; 1. Copies of the snapshot; 2. Space dimension of the snapshot. The first axis is omitted if only one single time instant is selected, in this case the output becomes a 2D matrix.

Return type

numpy.ndarray