# SimPEG.maps.ComplexMap#

class SimPEG.maps.ComplexMap(mesh=None, nP=None, **kwargs)[source]#

Bases: IdentityMap

Maps the real and imaginary component values stored in a model to complex values.

Let $$\mathbf{m}$$ be a model which stores the real and imaginary components of a set of complex values $$\mathbf{z}$$. Where the model parameters are organized into a vector of the form $$\mathbf{m} = [\mathbf{z}^\prime , \mathbf{z}^{\prime\prime}]$$, ComplexMap constructs the following mapping:

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

Note that the mapping is $$\mathbb{R}^{2n} \rightarrow \mathbb{C}^n$$.

Parameters:
meshdiscretize.BaseMesh

If a mesh is used to construct the mapping, the number of input model parameters is 2*mesh.nC and the number of complex values output from the mapping is equal to mesh.nC. If mesh is None, the dimensions of the mapping are set using the nP input argument.

nPint

Defines the number of input model parameters directly. Must be an even number!!! In this case, the number of complex values output from the mapping is nP/2. If nP = None, the dimensions of the mapping are set using the mesh input argument.

Examples

Here we construct a complex mapping on a 1D mesh comprised of 4 cells. The input model is real-valued array of length 8 (4 real and 4 imaginary values). The output of the mapping is a complex array with 4 values.

>>> from SimPEG.maps import ComplexMap
>>> from discretize import TensorMesh
>>> import numpy as np

>>> nC = 4
>>> mesh = TensorMesh([np.ones(nC)])

>>> z_real = np.ones(nC)
>>> z_imag = 2*np.ones(nC)
>>> m = np.r_[z_real, z_imag]
>>> m
array([1., 1., 1., 1., 2., 2., 2., 2.])

>>> mapping = ComplexMap(mesh=mesh)
>>> z = mapping * m
>>> z
array([1.+2.j, 1.+2.j, 1.+2.j, 1.+2.j])


Attributes

 nP Number of parameters the mapping acts on. shape Dimensions of the mapping

Methods

 deriv(m[, v]) Derivative of the complex mapping with respect to the input parameters.