function moments_XX

deeptime.covariance.moments_XX(X, remove_mean=False, modify_data=False, weights=None, sparse_mode='auto', sparse_tol=0.0, column_selection=None, diag_only=False)

Computes the first two unnormalized moments of X.

Computes \(s = \sum_t x_t\) and \(C = X^{\top} X\) while exploiting zero or constant columns in the data matrix.

Parameters:
  • X (ndarray (T, M)) – Data matrix

  • remove_mean (bool) – True: remove column mean from the data, False: don’t remove mean.

  • modify_data (bool) – If remove_mean=True, the mean will be removed in the data matrix X, without creating an independent copy. This option is faster but might lead to surprises because your input array is changed.

  • weights (None or ndarray(T, )) – weights assigned to each trajectory point. If None, all data points have weight one. If ndarray, each data point is assigned a separate weight.

  • sparse_mode (str) –

    one of:
    • ’dense’ : always use dense mode

    • ’sparse’ : always use sparse mode if possible

    • ’auto’ : automatic

  • sparse_tol (float) – Threshold for considering column to be zero in order to save computing effort when the data is sparse or almost sparse. If max(abs(X[:, i])) < sparse_tol, then row i (and also column i if Y is not given) of the covariance matrix will be set to zero. If Y is given and max(abs(Y[:, i])) < sparse_tol, then column i of the covariance matrix will be set to zero.

  • column_selection (ndarray(k, dtype=int) or None) – Indices of those columns that are to be computed. If None, all columns are computed.

  • diag_only (bool) – If True, the computation is restricted to the diagonal entries (autocorrelations) only.

Returns:

  • w (float) – statistical weight

  • s (ndarray (M)) – sum

  • C (ndarray (M, M)) – unnormalized covariance matrix