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:
- mesh
discretize.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.- nP
int
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.
- mesh
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
Determine whether or not this mapping is a linear operation.
The mesh used for the mapping
Number of parameters the mapping acts on.
Dimensions of the mapping
Methods
deriv
(m[, v])Derivative of the complex mapping with respect to the input parameters.
dot
(map1)Multiply two mappings to create a
simpeg.maps.ComboMap
.inverse
(D)The transform inverse is not implemented.
test
([m, num, random_seed])Derivative test for the mapping.