SimPEG.maps.ComplexMap.deriv#

ComplexMap.deriv(m, v=None)[source]#

Derivative of the complex mapping with respect to the input parameters.

The complex mapping maps the real and imaginary components stored in a model of the form \(\mathbf{m} = [\mathbf{z}^\prime , \mathbf{z}^{\prime\prime}]\) to their corresponding complex values \(\mathbf{z}\), i.e.

\[\mathbf{z}(\mathbf{m}) = \mathbf{z}^\prime + j \mathbf{z}^{\prime\prime}\]

The derivative of the mapping with respect to the model is block matrix of the form:

\[\frac{\partial \mathbf{z}}{\partial \mathbf{m}} = \big ( \mathbf{I} \;\;\; j\mathbf{I} \big )\]

where \(\mathbf{I}\) is the identity matrix of shape (nP/2, nP/2) and \(j = \sqrt{-1}\).

Parameters:
m(nP) numpy.ndarray

A vector representing a set of model parameters

v(nP) numpy.ndarray

If not None, the method returns the derivative times the vector v

Returns:
scipy.sparse.csr_matrix

Derivative of the mapping with respect to the model parameters. If the input argument v is not None, the method returns the derivative times the vector v.

Examples

Here we construct the derivative operator for the complex mapping on a 1D mesh comprised of 4 cells. We then demonstrate how the derivative of the mapping and its adjoint can be applied to a vector.

>>> from SimPEG.maps import ComplexMap
>>> from discretize import TensorMesh
>>> import numpy as np
>>> nC = 4
>>> mesh = TensorMesh([np.ones(nC)])
>>> m = np.random.rand(2*nC)
>>> mapping = ComplexMap(mesh=mesh)
>>> M = mapping.deriv(m)

When applying the derivative operator to a vector, it will convert the real and imaginary values stored in the vector to complex values; essentially applying the mapping.

>>> v1 = np.arange(0, 2*nC, 1)
>>> u1 = M * v1
>>> u1
array([0.+4.j, 1.+5.j, 2.+6.j, 3.+7.j])

When applying the adjoint of the derivative operator to a set of complex values, the operator will decompose these values into their real and imaginary components.

>>> v2 = np.arange(0, nC, 1) + 1j*np.arange(nC, 2*nC, 1)
>>> u2 = M.adjoint() * v2
>>> u2
array([0., 1., 2., 3., 4., 5., 6., 7.])