pylops.HStack#

class pylops.HStack(ops, nproc=1, forceflat=None, dtype=None)[source]#

Horizontal stacking.

Stack a set of N linear operators horizontally.

Parameters
opslist

Linear operators to be stacked. Alternatively, numpy.ndarray or scipy.sparse matrices can be passed in place of one or more operators.

nprocint, optional

Number of processes used to evaluate the N operators in parallel using multiprocessing. If nproc=1, work in serial mode.

forceflatbool, optional

New in version 2.2.0.

Force an array to be flattened after matvec.

dtypestr, optional

Type of elements in input array.

Raises
ValueError

If ops have different number of columns

Notes

An horizontal stack of N linear operators is created such as its application in forward mode leads to

\[\begin{split}\begin{bmatrix} \mathbf{L}_{1} & \mathbf{L}_{2} & \ldots & \mathbf{L}_{N} \end{bmatrix} \begin{bmatrix} \mathbf{x}_{1} \\ \mathbf{x}_{2} \\ \vdots \\ \mathbf{x}_{N} \end{bmatrix} = \mathbf{L}_{1} \mathbf{x}_1 + \mathbf{L}_{2} \mathbf{x}_2 + \ldots + \mathbf{L}_{N} \mathbf{x}_N\end{split}\]

while its application in adjoint mode leads to

\[\begin{split}\begin{bmatrix} \mathbf{L}_{1}^H \\ \mathbf{L}_{2}^H \\ \vdots \\ \mathbf{L}_{N}^H \end{bmatrix} \mathbf{y} = \begin{bmatrix} \mathbf{L}_{1}^H \mathbf{y} \\ \mathbf{L}_{2}^H \mathbf{y} \\ \vdots \\ \mathbf{L}_{N}^H \mathbf{y} \end{bmatrix} = \begin{bmatrix} \mathbf{x}_{1} \\ \mathbf{x}_{2} \\ \vdots \\ \mathbf{x}_{N} \end{bmatrix}\end{split}\]
Attributes
shapetuple

Operator shape

explicitbool

Operator contains a matrix that can be solved explicitly (True) or not (False)

Methods

__init__(ops[, nproc, forceflat, dtype])

adjoint()

apply_columns(cols)

Apply subset of columns of operator

cond([uselobpcg])

Condition number of linear operator.

conj()

Complex conjugate operator

div(y[, niter, densesolver])

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.

reset_count()

Reset counters

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.

trace([neval, method, backend])

Trace of linear operator.

transpose()

Examples using pylops.HStack#

Blending

Blending

Describe

Describe

Operators concatenation

Operators concatenation

Operators with Multiprocessing

Operators with Multiprocessing