Asymptotics (CGPT)¶
sies.asymptotics.cgpt ¶
Numerical computation of contracted generalized polarization tensors.
The CGPT matrix of order k of inclusions \(D_1, \dots, D_L\)
with contrasts \(\lambda_l\) is built from the boundary densities
$$ \phi_m = (\lambda I - K_D^)^{-1} \left[\frac{\partial \mathrm{Re}/\mathrm{Im}(z^m)}{\partial\nu}\right], $$ see Ammari & Kang, Polarization and Moment Tensors* (2007), chapter 4.
contrast ¶
contrast(cnd, pmtt=None, freq=0.0)
Compute the contrast constants \(\lambda\) of inclusions.
For conductivity k, permittivity eps and frequency f, the
contrast is
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cnd
|
array_like
|
Conductivity of each inclusion; must be positive and different from one (the background conductivity). |
required |
pmtt
|
array_like
|
Permittivity of each inclusion. Defaults to zero. |
None
|
freq
|
float
|
Working frequency; must be nonnegative. |
0.0
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Complex contrast constant of each inclusion. |
Notes
The \(2\pi\) factor comes from the Fourier transform convention \(\hat{f}(\omega) = \int f(x) e^{-2\pi i x \omega} dx\) used throughout the library (compatible with the FFT); published papers use the convention without the factor.
Source code in src/sies/asymptotics/cgpt.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
make_block_matrix ¶
make_block_matrix(inclusions)
Assemble the frequency-independent blocks of the system matrix.
The diagonal blocks are \(-K_{D_n}^*\) and the off-diagonal
(m, n) blocks are
\(-\partial_{\nu_m} S_{D_n}\). The contrast-dependent term
\(\lambda_n I\) is added later by make_system_matrix,
which makes multi-frequency computations cheap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inclusions
|
list of C2Boundary
|
Mutually disjoint inclusions, all discretized with the same number of boundary points. |
required |
Returns:
| Type | Description |
|---|---|
(ndarray, shape(L * n, L * n))
|
The block matrix, where |
Source code in src/sies/asymptotics/cgpt.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
make_system_matrix ¶
make_system_matrix(block_matrix, lambdas)
Assemble the full system matrix \(\lambda I - K_D^*\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block_matrix
|
ndarray
|
Frequency-independent blocks from |
required |
lambdas
|
array_like
|
Contrast constant of each inclusion. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The system matrix |
Source code in src/sies/asymptotics/cgpt.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
theoretical_cgpt ¶
theoretical_cgpt(inclusions, lambdas, order, block_matrix=None)
Compute the CGPT matrix of inclusions up to a given order.
Entries follow the convention
$$
M^{cc}{mn} = \int{\partial D} \mathrm{Re}(z^n) \,
(\lambda I - K_D^*)^{-1} \left[\partial_\nu \mathrm{Re}(z^m)\right] ds,
$$
and similarly for the cs, sc and ss blocks, interleaved
in a (2 * order, 2 * order) matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inclusions
|
C2Boundary or list of C2Boundary
|
The inclusion(s). |
required |
lambdas
|
array_like
|
Contrast constant of each inclusion. |
required |
order
|
int
|
Maximum CGPT order. |
required |
block_matrix
|
ndarray
|
Precomputed blocks from |
None
|
Returns:
| Type | Description |
|---|---|
(ndarray, shape(2 * order, 2 * order))
|
The CGPT matrix (complex if any contrast is complex). |
Source code in src/sies/asymptotics/cgpt.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
sies.asymptotics.exact ¶
Closed-form CGPT matrices of disks and ellipses.
These exact formulas (M. Lim's PhD thesis, also reported in Ammari &
Kang 2007) serve as reference values to validate the boundary integral
computation of theoretical_cgpt.
disk_cgpt ¶
disk_cgpt(order, radius, cnd)
Exact CGPT matrix of a disk centered at the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order
|
int
|
Maximum CGPT order. |
required |
radius
|
float
|
Radius of the disk. |
required |
cnd
|
float
|
Conductivity of the disk (background is one). |
required |
Returns:
| Type | Description |
|---|---|
(ndarray, shape(2 * order, 2 * order))
|
The diagonal CGPT matrix of the disk. |
Source code in src/sies/asymptotics/exact.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
ellipse_cgpt ¶
ellipse_cgpt(order, axis_a, axis_b, cnd)
Exact CGPT matrix of an ellipse centered at the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order
|
int
|
Maximum CGPT order. |
required |
axis_a
|
float
|
Semi-major axis length. |
required |
axis_b
|
float
|
Semi-minor axis length. |
required |
cnd
|
float
|
Conductivity of the ellipse (background is one). Complex values are not supported by the closed form. |
required |
Returns:
| Type | Description |
|---|---|
(ndarray, shape(2 * order, 2 * order))
|
The CGPT matrix of the ellipse. |
Source code in src/sies/asymptotics/exact.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
sies.asymptotics.transforms ¶
Transformation rules of CGPT matrices under rigid motions and scaling.
A CGPT matrix is stored as a (2k, 2k) array interleaving the four
cc, cs, sc and ss blocks. The complex CGPT pair
(N1, N2) diagonalizes the action of translations, rotations and
dilations, which makes these transformations explicit; see Ammari et
al., Target identification using dictionary matching of generalized
polarization tensors (2014).
split_cgpt ¶
split_cgpt(cgpt)
Split an interleaved CGPT matrix into its four blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cgpt
|
ndarray, shape (2k, 2k)
|
Interleaved CGPT matrix. |
required |
Returns:
| Type | Description |
|---|---|
cc, cs, sc, ss : ndarray, shape (k, k)
|
The four blocks of the CGPT. |
Source code in src/sies/asymptotics/transforms.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
join_cgpt ¶
join_cgpt(cc, cs, sc, ss)
Interleave the four CGPT blocks into a single matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cc
|
(ndarray, shape(k, k))
|
The four blocks of the CGPT. |
required |
cs
|
(ndarray, shape(k, k))
|
The four blocks of the CGPT. |
required |
sc
|
(ndarray, shape(k, k))
|
The four blocks of the CGPT. |
required |
ss
|
(ndarray, shape(k, k))
|
The four blocks of the CGPT. |
required |
Returns:
| Type | Description |
|---|---|
ndarray, shape (2k, 2k)
|
The interleaved CGPT matrix. |
Source code in src/sies/asymptotics/transforms.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
cgpt_to_complex ¶
cgpt_to_complex(cgpt)
Build the complex CGPT pair from an interleaved CGPT matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cgpt
|
ndarray, shape (2k, 2k)
|
Interleaved CGPT matrix. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
n1 |
(ndarray, shape(k, k))
|
First complex CGPT; symmetric. |
n2 |
(ndarray, shape(k, k))
|
Second complex CGPT; hermitian. |
Source code in src/sies/asymptotics/transforms.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
complex_to_cgpt ¶
complex_to_cgpt(n1, n2)
Convert the complex CGPT pair back to an interleaved CGPT matrix.
Only valid for real contrasts (real-valued CGPT).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n1
|
(ndarray, shape(k, k))
|
First complex CGPT. |
required |
n2
|
(ndarray, shape(k, k))
|
Second complex CGPT. |
required |
Returns:
| Type | Description |
|---|---|
ndarray, shape (2k, 2k)
|
The interleaved CGPT matrix. |
Source code in src/sies/asymptotics/transforms.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
transform_ccgpt ¶
transform_ccgpt(n1, n2, translation, scaling=1.0, rotation=0.0)
Apply rotation, then scaling, then translation to a complex CGPT pair.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n1
|
(ndarray, shape(k, k))
|
Complex CGPT pair of the original shape. |
required |
n2
|
(ndarray, shape(k, k))
|
Complex CGPT pair of the original shape. |
required |
translation
|
complex or array_like
|
Translation, as a complex number |
required |
scaling
|
float
|
Scaling factor. |
1.0
|
rotation
|
float
|
Rotation angle in radians. |
0.0
|
Returns:
| Type | Description |
|---|---|
z1, z2 : ndarray, shape (k, k)
|
Complex CGPT pair of the transformed shape. |
Source code in src/sies/asymptotics/transforms.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
transform_ccgpt_inverse ¶
transform_ccgpt_inverse(n1, n2, translation, scaling=1.0, rotation=0.0)
Apply the inverse transformation to a complex CGPT pair.
Undo a translation, then a scaling, then a rotation (the inverse of
transform_ccgpt with the same arguments).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n1
|
(ndarray, shape(k, k))
|
Complex CGPT pair of the transformed shape. |
required |
n2
|
(ndarray, shape(k, k))
|
Complex CGPT pair of the transformed shape. |
required |
translation
|
complex or array_like
|
Translation to undo. |
required |
scaling
|
float
|
Scaling factor to undo. |
1.0
|
rotation
|
float
|
Rotation angle to undo, in radians. |
0.0
|
Returns:
| Type | Description |
|---|---|
z1, z2 : ndarray, shape (k, k)
|
Complex CGPT pair with the transformation removed. |
Source code in src/sies/asymptotics/transforms.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | |
transform_cgpt ¶
transform_cgpt(cgpt, translation, scaling=1.0, rotation=0.0)
Apply rotation, then scaling, then translation to a CGPT matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cgpt
|
ndarray, shape (2k, 2k)
|
Interleaved CGPT matrix of the original shape. |
required |
translation
|
complex or array_like
|
Translation, as a complex number |
required |
scaling
|
float
|
Scaling factor. |
1.0
|
rotation
|
float
|
Rotation angle in radians. |
0.0
|
Returns:
| Type | Description |
|---|---|
ndarray, shape (2k, 2k)
|
CGPT matrix of the transformed shape. |
Source code in src/sies/asymptotics/transforms.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |