# pylops.CausalIntegration¶

class pylops.CausalIntegration(N, dims=None, dir=-1, sampling=1, halfcurrent=True, dtype='float64', kind='full', removefirst=False)[source]

Causal integration.

Apply causal integration to a multi-dimensional array along dir axis.

Parameters: N : int Number of samples in model. dims : list, optional Number of samples for each dimension (None if only one dimension is available) dir : int, optional Direction along which smoothing is applied. sampling : float, optional Sampling step dx. halfcurrent : bool, optional Add half of current value (True) or the entire value (False). This will be deprecated in v2.0.0, use instead kind=half to obtain the same behaviour. dtype : str, optional Type of elements in input array. kind : str, optional Integration kind (full, half, or trapezoidal). removefirst : bool, optional Remove first sample (True) or not (False).

Notes

The CausalIntegration operator applies a causal integration to any chosen direction of a multi-dimensional array.

For simplicity, given a one dimensional array, the causal integration is:

$y(t) = \int x(t) dt$

which can be discretised as :

$y[i] = \sum_{j=0}^i x[j] dt$

or

$y[i] = (\sum_{j=0}^{i-1} x[j] + 0.5x[i]) dt$

or

$y[i] = (\sum_{j=1}^{i-1} x[j] + 0.5x + 0.5x[i]) dt$

where $$dt$$ is the sampling interval. In our implementation, the choice to add $$x[i]$$ or $$0.5x[i]$$ is made by selecting kind=full or kind=half, respectively. The choice to add $$0.5x[i]$$ and $$0.5x$$ instead of made by selecting the kind=trapezoidal.

Note that the integral of a signal has no unique solution, as any constant $$c$$ can be added to $$y$$, for example if $$x(t)=t^2$$ the resulting integration is:

$y(t) = \int t^2 dt = \frac{t^3}{3} + c$

If we apply a first derivative to $$y$$ we in fact obtain:

$x(t) = \frac{dy}{dt} = t^2$

no matter the choice of $$c$$.

Attributes: shape : tuple Operator shape explicit : bool Operator contains a matrix that can be solved explicitly (True) or not (False)

Methods

 __init__(N[, dims, dir, sampling, …]) Initialize this LinearOperator. adjoint() Hermitian adjoint. apply_columns(cols) Apply subset of columns of operator cond([uselobpcg]) Condition number of linear operator. conj() Complex conjugate operator div(y[, niter]) Solve the linear problem $$\mathbf{y}=\mathbf{A}\mathbf{x}$$. dot(x) Matrix-matrix or matrix-vector multiplication. eigs([neigs, symmetric, niter, uselobpcg]) Most significant eigenvalues of linear operator. matmat(X) Matrix-matrix multiplication. matvec(x) Matrix-vector multiplication. rmatmat(X) Matrix-matrix multiplication. rmatvec(x) Adjoint matrix-vector multiplication. todense([backend]) Return dense matrix. toimag([forw, adj]) Imag operator toreal([forw, adj]) Real operator tosparse() Return sparse matrix. transpose() Transpose this linear operator.

## Examples using pylops.CausalIntegration¶ Causal Integration