Returned types¶
Python helper objects¶
Private classes that public methods return, such as the solver of
TMatrix.interaction.
_IncidentSelection¶
The fixed matching of an incident wave to diffraction ports.
_IncidentSelection.pullback¶
_IncidentSelection.pullback(gradient: Any) -> tuple[Any, ...]
Map port gradients to incident coefficients; metadata gradients are zero.
_IncidentSelection.pushforward¶
_IncidentSelection.pushforward(tangent: Any, *metadata: Any) -> Any
Select incident tangents at ports; metadata does not affect the selection.
_IncidentSelection.selection¶
_IncidentSelection.selection: Any
_IncidentSelection.metadata¶
_IncidentSelection.metadata: tuple[Any, ...]
_InteractionFactor¶
Prepared coupling for differentiable incident-column solves.
The coupling is reused. Each solve records its own native factorization so its derivative remains connected to the local response and the coupling.
_InteractionFactor.solve¶
_InteractionFactor.solve(incident: Any) -> Any
Scattered coefficients for a vector or a batch of incident columns.
_Interaction¶
_Interaction.solve¶
_Interaction.solve() -> TMatrix | CylindricalTMatrix
Return the full coupled matrix (I - T*C)^-1 T in the local basis.
_Interaction.factor¶
_Interaction.factor() -> _native.InteractionFactor
Factor once for repeated incident-field solves without a full response matrix.
The returned factor's solve/record methods accept complex128 arrays with one incident illumination per column.
Pullback InteractionFactor.pullback_incident(cotangent: ArrayLike) -> ComplexArray
_Interaction.illuminate¶
_Interaction.illuminate(incident: ArrayLike | PlaneWave | Wave) -> NDArray[np.complex128]
Solve (I-T*C) scattered = T*incident for requested illuminations.
Incident may be a matching PlaneWave/Wave, a shape-(modes,)
coefficient vector or an array (modes, illuminations). Returns complex128
scattered coefficients with the same vector/batch rank. A fresh factor
is built per call; use factor().solve for repeated right-hand sides.
_PeriodicInteraction¶
_PeriodicInteraction.coupling¶
_PeriodicInteraction.coupling(lattice: ArrayLike, kpar: ArrayLike, *, eta: complex=0) -> NDArray[np.complex128]
Return the coupling matrix C of the lattice.
C expands the waves scattered by every other lattice site in regular
waves at this site. lattice holds the lattice vectors and kpar the
Bloch vector. eta sets where the Ewald method splits each lattice
sum into a real-space and a reciprocal-space part; 0 picks it
automatically.
_PeriodicInteraction.solve¶
_PeriodicInteraction.solve(lattice: ArrayLike, kpar: ArrayLike, *, eta: complex=0) -> NDArray[np.complex128]
Effective periodic response in local multipole channels.
This is not an isolated-particle T-matrix; finite-particle cross-section formulae do not apply. Use its array with incident channel coefficients.
_PeriodicInteraction.factor¶
_PeriodicInteraction.factor(lattice: ArrayLike, kpar: ArrayLike, *, eta: complex=0) -> _native.InteractionFactor
Reusable periodic factor for requested incident channel coefficients.
Pullback InteractionFactor.pullback_incident(cotangent: ArrayLike) -> ComplexArray
_PeriodicInteraction.illuminate¶
_PeriodicInteraction.illuminate(incident: ArrayLike | PlaneWave | Wave, lattice: ArrayLike, kpar: ArrayLike, *, eta: complex=0) -> NDArray[np.complex128]
Compute requested periodic response columns without the full effective T matrix.
_ClusterFactor¶
Reuse a differentiable cluster's prepared coupling and particle blocks.
_ClusterFactor.scatter¶
_ClusterFactor.scatter(incident: Any) -> Wave
Solve incident columns with a fresh native differentiation record.
Native contexts and factors¶
Objects of the compiled extension that records and factorizations
return. Use them through the public calls that return them; their
constructors belong to the private treams_rs._native module.
SolveContext¶
Created by diff.solve. pullback(cotangent) -> (operator, rhs).
SolveContext.pushforward¶
SolveContext.pushforward(operator: ArrayLike, rhs: ArrayLike) -> ComplexArray
SolveContext.pullback¶
SolveContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, ComplexArray]
EigContext¶
Created by diff.eig. pullback(eigenvalues, eigenvectors) -> operator, one
cotangent for each output.
pushforward(operator) returns the eigenvalue and eigenvector tangents.
It requires distinct eigenvalues and unique largest eigenvector components
for the recorded phase convention.
EigContext.pushforward¶
EigContext.pushforward(operator: ArrayLike) -> tuple[ComplexArray, ComplexArray]
EigContext.pullback¶
EigContext.pullback(eigenvalues: ArrayLike, eigenvectors: ArrayLike) -> ComplexArray
EigvalsContext¶
Created by diff.eigvals. Derivatives of eigenvalues alone.
Pushforwards require distinct real parts; eigenvector phase ties are valid. Pullbacks allow equal weights at real-part ties and repeated eigenvalues.
EigvalsContext.pushforward¶
EigvalsContext.pushforward(operator: ArrayLike) -> ComplexArray
EigvalsContext.pullback¶
EigvalsContext.pullback(eigenvalues: ArrayLike) -> ComplexArray
SvdvalsContext¶
Created by diff.svdvals. pullback(cotangent) -> operator.
pushforward(operator) requires distinct positive singular values.
Smooth spectral sums can still have pullbacks at repeated or zero values.
SvdvalsContext.pushforward¶
SvdvalsContext.pushforward(operator: ArrayLike) -> RealArray
SvdvalsContext.pullback¶
SvdvalsContext.pullback(cotangent: ArrayLike) -> ComplexArray
CoordinatesContext¶
Created by diff.coordinates. pullback(cotangent) -> points.
CoordinatesContext.pushforward¶
CoordinatesContext.pushforward(points_tangent: ArrayLike) -> RealArray
CoordinatesContext.pullback¶
CoordinatesContext.pullback(cotangent: RealArray) -> RealArray
VectorCoordinatesContext¶
Created by diff.vector_coordinates. pullback(cotangent) -> (vectors, points).
VectorCoordinatesContext.pushforward¶
VectorCoordinatesContext.pushforward(vectors_tangent: ArrayLike, points_tangent: ArrayLike) -> ComplexArray
VectorCoordinatesContext.pullback¶
VectorCoordinatesContext.pullback(cotangent: ComplexArray) -> tuple[ComplexArray, RealArray]
IncgammaContext¶
Created by diff.incgamma. pullback(cotangent) -> z.
IncgammaContext.pushforward¶
IncgammaContext.pushforward(*tangents: ArrayLike) -> ComplexArray
IncgammaContext.pullback¶
IncgammaContext.pullback(cotangent: ComplexArray) -> ComplexArray
IntkambeContext¶
Created by diff.intkambe. pullback(cotangent) -> (z, eta).
IntkambeContext.pushforward¶
IntkambeContext.pushforward(*tangents: ArrayLike) -> ComplexArray
IntkambeContext.pullback¶
IntkambeContext.pullback(cotangent: ComplexArray) -> tuple[ComplexArray, ComplexArray]
BesselContext¶
Created by diff.bessel. pullback(cotangent) -> z.
BesselContext.pushforward¶
BesselContext.pushforward(*tangents: ArrayLike) -> ComplexArray
BesselContext.pullback¶
BesselContext.pullback(cotangent: ComplexArray) -> ComplexArray
AngularContext¶
Created by diff.angular. pullback(cotangent) -> z.
AngularContext.pushforward¶
AngularContext.pushforward(*tangents: ArrayLike) -> ComplexArray
AngularContext.pullback¶
AngularContext.pullback(cotangent: ComplexArray) -> ComplexArray
WignerdContext¶
Created by diff.wignerd. pullback(cotangent) -> (phi, theta, psi).
WignerdContext.pushforward¶
WignerdContext.pushforward(*tangents: ArrayLike) -> ComplexArray
WignerdContext.pullback¶
WignerdContext.pullback(cotangent: ComplexArray) -> tuple[ComplexArray, ComplexArray, ComplexArray]
LatticeSumContext¶
Created by diff.lattice_sum. pullback(cotangent) -> (k, kpar, a, r, eta).
LatticeSumContext.pushforward¶
LatticeSumContext.pushforward(k: ArrayLike, kpar: ArrayLike, a: ArrayLike, r: ArrayLike, eta: ArrayLike) -> ComplexArray
LatticeSumContext.pullback¶
LatticeSumContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, RealArray, RealArray, RealArray, ComplexArray]
LatticeExpansionContext¶
Created by diff.lattice_expansion.
pullback(cotangent) -> (destination_positions, source_positions, ks, kpar, a).
For cylindrical bases, pullback_axial(cotangent) appends the gradient of
kzs, the sorted distinct axial wavenumbers.
LatticeExpansionContext.pushforward¶
LatticeExpansionContext.pushforward(destination: ArrayLike, source: ArrayLike, ks: ArrayLike, kpar: ArrayLike, vectors: ArrayLike) -> ComplexArray
LatticeExpansionContext.pushforward_axial¶
LatticeExpansionContext.pushforward_axial(destination: ArrayLike, source: ArrayLike, ks: ArrayLike, kpar: ArrayLike, vectors: ArrayLike, axial: ArrayLike) -> ComplexArray
LatticeExpansionContext.pullback_axial¶
LatticeExpansionContext.pullback_axial(cotangent: ArrayLike) -> tuple[RealArray, RealArray, ComplexArray, RealArray, RealArray, RealArray]
LatticeExpansionContext.pullback¶
LatticeExpansionContext.pullback(cotangent: ArrayLike) -> tuple[RealArray, RealArray, ComplexArray, RealArray, RealArray]
LatticeExpansionFromTableContext¶
Created by diff.lattice_expansion_from_table. pullback(cotangent) -> values,
the gradient of the lattice-sum table.
LatticeExpansionFromTableContext.pushforward¶
LatticeExpansionFromTableContext.pushforward(tangent: ArrayLike) -> ComplexArray
LatticeExpansionFromTableContext.pullback¶
LatticeExpansionFromTableContext.pullback(cotangent: ArrayLike) -> ComplexArray
SphericalChannelsContext¶
Created by diff.spherical_channels.
pullback(cotangent) -> (positions, ks, q, area).
SphericalChannelsContext.pushforward¶
SphericalChannelsContext.pushforward(positions: ArrayLike, ks: ArrayLike, q: ArrayLike, measure: float) -> ComplexArray
SphericalChannelsContext.pullback¶
SphericalChannelsContext.pullback(cotangent: ArrayLike) -> tuple[RealArray, ComplexArray, RealArray, float]
CylindricalChannelsContext¶
Created by diff.cylindrical_channels.
pullback(cotangent) -> (positions, ks, q, period).
CylindricalChannelsContext.pushforward¶
CylindricalChannelsContext.pushforward(positions: ArrayLike, ks: ArrayLike, q: ArrayLike, measure: float) -> ComplexArray
CylindricalChannelsContext.pullback¶
CylindricalChannelsContext.pullback(cotangent: ArrayLike) -> tuple[RealArray, ComplexArray, RealArray, float]
ExpansionContext¶
Created by diff.expansion (through expansion, cylindrical_expansion
or cw_to_sw).
pullback(cotangent) -> (destination_positions, source_positions, ks). For two
cylindrical bases, pullback_axial(cotangent) appends the gradient of kzs,
the sorted distinct axial wavenumbers.
ExpansionContext.pushforward¶
ExpansionContext.pushforward(destination_positions: ArrayLike, source_positions: ArrayLike, ks: ArrayLike) -> ComplexArray
ExpansionContext.pushforward_axial¶
ExpansionContext.pushforward_axial(destination_positions: ArrayLike, source_positions: ArrayLike, ks: ArrayLike, kz: ArrayLike) -> ComplexArray
ExpansionContext.pullback_axial¶
ExpansionContext.pullback_axial(cotangent: ArrayLike) -> tuple[RealArray, RealArray, ComplexArray, RealArray]
ExpansionContext.pullback¶
ExpansionContext.pullback(cotangent: ArrayLike) -> tuple[RealArray, RealArray, ComplexArray]
PeriodicToCwContext¶
Created by diff.periodic_to_cw.
pullback(cotangent) -> (destination_positions, source_positions, ks, kz, period),
with one kz per destination mode.
PeriodicToCwContext.pushforward¶
PeriodicToCwContext.pushforward(destination_positions: ArrayLike, source_positions: ArrayLike, ks: ArrayLike, kz: ArrayLike, period: float) -> ComplexArray
PeriodicToCwContext.pullback¶
PeriodicToCwContext.pullback(cotangent: ArrayLike) -> tuple[RealArray, RealArray, ComplexArray, RealArray, float]
FieldContext¶
Created by diff.field (through field or cylindrical_field).
pullback(cotangent) -> (coefficients, points, positions, ks). For a
cylindrical basis, pullback_axial(cotangent) appends the gradient of kz,
one per mode.
FieldContext.pushforward¶
FieldContext.pushforward(coefficients: ArrayLike, points: ArrayLike, positions: ArrayLike, ks: ArrayLike) -> ComplexArray
FieldContext.pushforward_axial¶
FieldContext.pushforward_axial(coefficients: ArrayLike, points: ArrayLike, positions: ArrayLike, ks: ArrayLike, kz: ArrayLike) -> ComplexArray
FieldContext.pullback¶
FieldContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, RealArray, RealArray, ComplexArray]
FieldContext.pullback_axial¶
FieldContext.pullback_axial(cotangent: ArrayLike) -> tuple[ComplexArray, RealArray, RealArray, ComplexArray, RealArray]
FieldOperatorContext¶
Created by diff.field_operator (through field_operator or
cylindrical_field_operator).
pullback(cotangent) -> (points, positions, ks). For a cylindrical basis,
pullback_axial(cotangent) appends the gradient of kz, one per mode.
FieldOperatorContext.pushforward¶
FieldOperatorContext.pushforward(points: ArrayLike, positions: ArrayLike, ks: ArrayLike) -> ComplexArray
FieldOperatorContext.pushforward_axial¶
FieldOperatorContext.pushforward_axial(points: ArrayLike, positions: ArrayLike, ks: ArrayLike, kz: ArrayLike) -> ComplexArray
FieldOperatorContext.pullback¶
FieldOperatorContext.pullback(cotangent: ArrayLike) -> tuple[RealArray, RealArray, ComplexArray]
FieldOperatorContext.pullback_axial¶
FieldOperatorContext.pullback_axial(cotangent: ArrayLike) -> tuple[RealArray, RealArray, ComplexArray, RealArray]
PlaneExpansionContext¶
Created by diff.plane_expansion. pullback(cotangent) -> (positions, vectors).
PlaneExpansionContext.pushforward¶
PlaneExpansionContext.pushforward(positions: ArrayLike, vectors: ArrayLike) -> ComplexArray
PlaneExpansionContext.pullback¶
PlaneExpansionContext.pullback(cotangent: ArrayLike) -> tuple[RealArray, ComplexArray]
PlaneFieldContext¶
Created by diff.plane_field.
pullback(cotangent) -> (coefficients, points, vectors); the coefficient
gradient is empty for a field operator.
PlaneFieldContext.pushforward¶
PlaneFieldContext.pushforward(coefficients: ArrayLike, points: ArrayLike, vectors: ArrayLike) -> ComplexArray
PlaneFieldContext.pullback¶
PlaneFieldContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, RealArray, ComplexArray]
PlanePhasesContext¶
Created by diff.plane_phases. pullback(cotangent) -> (points, vectors).
PlanePhasesContext.pushforward¶
PlanePhasesContext.pushforward(points: ArrayLike, vectors: ArrayLike) -> ComplexArray
PlanePhasesContext.pullback¶
PlanePhasesContext.pullback(cotangent: ArrayLike) -> tuple[RealArray, ComplexArray]
PlanePermutationContext¶
Created by diff.plane_permutation. pullback(cotangent) -> vectors.
PlanePermutationContext.pushforward¶
PlanePermutationContext.pushforward(vectors: ArrayLike) -> ComplexArray
PlanePermutationContext.pullback¶
PlanePermutationContext.pullback(cotangent: ArrayLike) -> ComplexArray
RotationContext¶
Created by diff.rotation. pullback(cotangent) -> [phi, theta, psi], a list
of three floats.
RotationContext.pushforward¶
RotationContext.pushforward(angles: ArrayLike) -> ComplexArray
RotationContext.pullback¶
RotationContext.pullback(cotangent: ArrayLike) -> list[float]
SphericalTranslationContext¶
Created by diff.spherical_translation.
pullback(cotangent) -> (kr, theta, phi).
SphericalTranslationContext.pushforward¶
SphericalTranslationContext.pushforward(*tangents: ArrayLike) -> ComplexArray
SphericalTranslationContext.pullback¶
SphericalTranslationContext.pullback(cotangent: ComplexArray) -> tuple[ComplexArray, ComplexArray, ComplexArray]
CylindricalTranslationContext¶
Created by diff.cylindrical_translation.
pullback(cotangent) -> (krr, phi, z, kz).
CylindricalTranslationContext.pushforward¶
CylindricalTranslationContext.pushforward(*tangents: ArrayLike) -> ComplexArray
CylindricalTranslationContext.pullback¶
CylindricalTranslationContext.pullback(cotangent: ComplexArray) -> tuple[ComplexArray, ComplexArray, ComplexArray, ComplexArray]
VectorWaveContext¶
Created by diff.vector_wave and diff.sph_harm.
pullback(cotangent) returns one gradient per argument, in order.
VectorWaveContext.pushforward¶
VectorWaveContext.pushforward(*tangents: ArrayLike) -> ComplexArray
VectorWaveContext.pullback¶
VectorWaveContext.pullback(cotangent: ComplexArray) -> tuple[ComplexArray, ...]
SphereClusterContext¶
Created by diff.sphere_cluster.
pullback(cotangent) -> (k0, radii, epsilon, positions).
SphereClusterContext.pushforward¶
SphereClusterContext.pushforward(k0: ArrayLike, radii: ArrayLike, epsilon: ArrayLike, positions: ArrayLike) -> ComplexArray
SphereClusterContext.pullback¶
SphereClusterContext.pullback(cotangent: ArrayLike) -> tuple[float, RealArray, ComplexArray, RealArray]
InteractionContext¶
Created by diff.interaction. pullback(cotangent) -> (local, coupling).
InteractionContext.pushforward¶
InteractionContext.pushforward(local: ArrayLike, coupling: ArrayLike) -> ComplexArray
InteractionContext.pullback¶
InteractionContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, ComplexArray]
ParticleClusterContext¶
Created by diff.particle_cluster.
pullback(cotangent) -> (local, positions, ks), where local is a list
with one gradient per particle.
ParticleClusterContext.pushforward¶
ParticleClusterContext.pushforward(local: Sequence[ArrayLike], positions: ArrayLike, ks: ArrayLike) -> ComplexArray
ParticleClusterContext.pullback¶
ParticleClusterContext.pullback(cotangent: ArrayLike) -> tuple[list[ComplexArray], RealArray, ComplexArray]
InteractionFactor¶
LU factors of I - T C, for solving only the requested incident columns.
diff.factor_interaction builds it from a dense T (the constructor),
diff.factor_interaction_blocks from separate particle blocks
(from_blocks), and diff.sphere_cluster_factor from homogeneous spheres.
solve(incident) returns the scattered coefficients;
record(incident) also returns an IlluminateContext.
InteractionFactor.__init__¶
InteractionFactor(local: ComplexArray, coupling: ComplexArray) -> None
InteractionFactor.from_blocks¶
InteractionFactor.from_blocks(local: list[ComplexArray], coupling: ComplexArray) -> InteractionFactor
Pullback InteractionFactor.pullback_incident(cotangent: ArrayLike) -> ComplexArray
InteractionFactor.dimension¶
InteractionFactor.dimension: int
InteractionFactor.solve¶
InteractionFactor.solve(incident: ComplexArray) -> ComplexArray
InteractionFactor.pullback_incident¶
InteractionFactor.pullback_incident(cotangent: ArrayLike) -> ComplexArray
InteractionFactor.record¶
InteractionFactor.record(incident: ComplexArray) -> tuple[ComplexArray, IlluminateContext]
Pullback IlluminateContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, ComplexArray, ComplexArray]
Pullback IlluminateContext.pullback_blocks(cotangent: ArrayLike) -> tuple[list[ComplexArray], ComplexArray, ComplexArray]
IlluminateContext¶
Created by InteractionFactor.record, which diff.illuminate calls.
The factor decides the derivative method when it is built, and the other form raises ValueError:
- dense T (
factor_interaction,illuminate):pullback(cotangent) -> (local, coupling, incident); - blocks (
factor_interaction_blocks,sphere_cluster_factor):pullback_blocks(cotangent) -> (local, coupling, incident), wherelocalis a list with one gradient per block.
pushforward(local, coupling, incident) and pushforward_blocks take
the corresponding dense or per-block tangents and return scattered-field
tangents.
IlluminateContext.pushforward¶
IlluminateContext.pushforward(local: ArrayLike, coupling: ArrayLike, incident: ArrayLike) -> ComplexArray
IlluminateContext.pushforward_blocks¶
IlluminateContext.pushforward_blocks(local: Sequence[ArrayLike], coupling: ArrayLike, incident: ArrayLike) -> ComplexArray
IlluminateContext.pullback¶
IlluminateContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, ComplexArray, ComplexArray]
IlluminateContext.pullback_blocks¶
IlluminateContext.pullback_blocks(cotangent: ArrayLike) -> tuple[list[ComplexArray], ComplexArray, ComplexArray]
MieContext¶
Created by diff.mie. pullback(cotangent) -> (x, epsilon, mu, kappa).
MieContext.pushforward¶
MieContext.pushforward(sizes: ArrayLike, epsilon: ArrayLike, mu: ArrayLike, kappa: ArrayLike) -> ComplexArray
MieContext.pullback¶
MieContext.pullback(cotangent: ArrayLike) -> tuple[RealArray, ComplexArray, ComplexArray, ComplexArray]
MieCylContext¶
Created by diff.mie_cyl.
pullback(cotangent) -> (kz, k0, radii, epsilon, mu, kappa).
MieCylContext.pushforward¶
MieCylContext.pushforward(kz: ArrayLike, k0: ArrayLike, radii: ArrayLike, epsilon: ArrayLike, mu: ArrayLike, kappa: ArrayLike) -> ComplexArray
MieCylContext.pullback¶
MieCylContext.pullback(cotangent: ArrayLike) -> tuple[float, float, RealArray, ComplexArray, ComplexArray, ComplexArray]
EbcmQmatContext¶
Created by diff.ebcm_qmat. pullback(cotangent) -> (radii, slopes, ks, zs).
EbcmQmatContext.pushforward¶
EbcmQmatContext.pushforward(radii: ArrayLike, slopes: ArrayLike, ks: ArrayLike, zs: ArrayLike) -> ComplexArray
EbcmQmatContext.pullback¶
EbcmQmatContext.pullback(cotangent: ArrayLike) -> tuple[RealArray, RealArray, ComplexArray, ComplexArray]
IterativeSphereCluster¶
Matrix-free operator of a sphere cluster, solved with GMRES.
iterative.SphereCluster wraps it. solve(incident) returns the
scattered coefficients and the convergence of each illumination;
record(incident) also returns an IterativeContext before the
convergence.
IterativeSphereCluster.__init__¶
IterativeSphereCluster(lmax: int, k0: float, radii: RealArray, epsilon: ComplexArray, positions: RealArray) -> None
IterativeSphereCluster.dimension¶
IterativeSphereCluster.dimension: int
IterativeSphereCluster.solve¶
IterativeSphereCluster.solve(incident: ComplexArray, *, rtol: float=1e-10, atol: float=0.0, restart: int=30, max_iterations: int=300) -> tuple[ComplexArray, list[Convergence]]
IterativeSphereCluster.record¶
IterativeSphereCluster.record(incident: ComplexArray, *, rtol: float=1e-10, atol: float=0.0, restart: int=30, max_iterations: int=300) -> tuple[ComplexArray, IterativeContext, list[Convergence]]
Pullback IterativeContext.pullback(cotangent: ArrayLike) -> tuple[float, RealArray, ComplexArray, RealArray, ComplexArray, list[Convergence]]
IterativeContext¶
Created by IterativeSphereCluster.record, which
iterative.SphereCluster.record calls.
pullback(cotangent) -> (k0, radii, epsilon, positions, incident, convergence).
The last item is no gradient: it holds the GMRES convergence of each
solve of the adjoint (conjugate-transposed) system.
pushforward(k0, radii, epsilon, positions, incident) returns the scattered
coefficient tangent and convergence certificates for the tangent solves.
IterativeContext.pushforward¶
IterativeContext.pushforward(k0: float, radii: ArrayLike, epsilon: ArrayLike, positions: ArrayLike, incident: ArrayLike) -> tuple[ComplexArray, list[Convergence]]
IterativeContext.pullback¶
IterativeContext.pullback(cotangent: ArrayLike) -> tuple[float, RealArray, ComplexArray, RealArray, ComplexArray, list[Convergence]]
SphereContext¶
Created by diff.sphere. pullback(cotangent) -> (k0, radii, epsilon, mu, kappa).
SphereContext.pushforward¶
SphereContext.pushforward(k0: ArrayLike, radii: ArrayLike, epsilon: ArrayLike, mu: ArrayLike, kappa: ArrayLike) -> ComplexArray
SphereContext.pullback¶
SphereContext.pullback(cotangent: ArrayLike) -> tuple[float, RealArray, ComplexArray, ComplexArray, ComplexArray]
CylinderContext¶
Created by diff.cylinder.
pullback(cotangent) -> (kzs, k0, radii, epsilon, mu, kappa).
CylinderContext.pushforward¶
CylinderContext.pushforward(kzs: ArrayLike, k0: ArrayLike, radii: ArrayLike, epsilon: ArrayLike, mu: ArrayLike, kappa: ArrayLike) -> ComplexArray
CylinderContext.pullback¶
CylinderContext.pullback(cotangent: ArrayLike) -> tuple[RealArray, float, RealArray, ComplexArray, ComplexArray, ComplexArray]
TMatrixMetricContext¶
Created by diff.tmatrix_metric. pullback(cotangent) -> (operator, ks) for
a float cotangent.
TMatrixMetricContext.pushforward¶
TMatrixMetricContext.pushforward(operator: ArrayLike, ks: ArrayLike) -> float
TMatrixMetricContext.pullback¶
TMatrixMetricContext.pullback(cotangent: float) -> tuple[ComplexArray, RealArray]
SMatrixAddContext¶
Created by diff.smatrix_add. pullback(cotangent) -> (lower, upper).
SMatrixAddContext.pushforward¶
SMatrixAddContext.pushforward(lower: ArrayLike, upper: ArrayLike) -> ComplexArray
SMatrixAddContext.pullback¶
SMatrixAddContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, ComplexArray]
SMatrixIlluminateContext¶
Created by diff.smatrix_illuminate.
pullback(cotangent) -> (lower, upper, up, down).
SMatrixIlluminateContext.pushforward¶
SMatrixIlluminateContext.pushforward(lower: ArrayLike, upper: ArrayLike, up: ArrayLike, down: ArrayLike) -> ComplexArray
SMatrixIlluminateContext.pullback¶
SMatrixIlluminateContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, ComplexArray, ComplexArray, ComplexArray]
SMatrixPeriodicContext¶
Created by diff.smatrix_periodic. pullback(cotangent) -> smats.
SMatrixPeriodicContext.pushforward¶
SMatrixPeriodicContext.pushforward(smats: ArrayLike) -> ComplexArray
SMatrixPeriodicContext.pullback¶
SMatrixPeriodicContext.pullback(cotangent: ArrayLike) -> ComplexArray
BandsContext¶
Created by diff.bands. pullback(wavenumbers, eigenvectors) -> (smats, period),
one cotangent for each output.
BandsContext.pushforward¶
BandsContext.pushforward(smats: ArrayLike, period: ArrayLike) -> tuple[ComplexArray, ComplexArray]
BandsContext.pullback¶
BandsContext.pullback(wavenumbers: ArrayLike, eigenvectors: ArrayLike) -> tuple[ComplexArray, float]
SMatrixFromArrayContext¶
Created by diff.smatrix_from_array.
pullback(cotangent) -> (response, channels).
SMatrixFromArrayContext.pushforward¶
SMatrixFromArrayContext.pushforward(response: ArrayLike, channels: ArrayLike) -> ComplexArray
SMatrixFromArrayContext.pullback¶
SMatrixFromArrayContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, ComplexArray]
SMatrixTrContext¶
Created by diff.smatrix_tr.
pullback(cotangent) -> (matrices, incident, ks, zs, q).
SMatrixTrContext.pushforward¶
SMatrixTrContext.pushforward(matrices: ArrayLike, incident: ArrayLike, ks: ArrayLike, zs: ArrayLike, q: ArrayLike) -> RealArray
SMatrixTrContext.pullback¶
SMatrixTrContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, ComplexArray, ComplexArray, ComplexArray, RealArray]
FresnelContext¶
Created by diff.fresnel. pullback(cotangent) -> (ks, kzs, zs).
FresnelContext.pushforward¶
FresnelContext.pushforward(ks: ArrayLike, kzs: ArrayLike, zs: ArrayLike) -> ComplexArray
FresnelContext.pullback¶
FresnelContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, ComplexArray, ComplexArray]
InterfaceCoefficientsContext¶
Created by diff.interface_coefficients. pullback(cotangent) -> (ks, zs, q).
InterfaceCoefficientsContext.pushforward¶
InterfaceCoefficientsContext.pushforward(ks: ArrayLike, zs: ArrayLike, q: ArrayLike) -> ComplexArray
InterfaceCoefficientsContext.pullback¶
InterfaceCoefficientsContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, ComplexArray, RealArray]
PropagationMatrixContext¶
Created by diff.propagation_matrix.
pullback(cotangent) -> (vectors, distance).
PropagationMatrixContext.pushforward¶
PropagationMatrixContext.pushforward(vectors: ArrayLike, distance: ArrayLike) -> ComplexArray
PropagationMatrixContext.pullback¶
PropagationMatrixContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, RealArray]
LayerStackContext¶
Created by diff.layer_stack. pullback(cotangent) -> (ks, zs, q, thickness).
LayerStackContext.pushforward¶
LayerStackContext.pushforward(ks: ArrayLike, zs: ArrayLike, q: ArrayLike, thickness: ArrayLike) -> ComplexArray
LayerStackContext.pullback¶
LayerStackContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, ComplexArray, RealArray, RealArray]
ChiralityDensityContext¶
Created by diff.chirality_density. pullback(cotangent) -> (ks, normal, z).
ChiralityDensityContext.pushforward¶
ChiralityDensityContext.pushforward(ks: ArrayLike, normal: ArrayLike, interval: ArrayLike) -> ComplexArray
ChiralityDensityContext.pullback¶
ChiralityDensityContext.pullback(cotangent: ArrayLike) -> tuple[ComplexArray, ComplexArray, RealArray]
OrientedChiralityContext¶
Created by diff.oriented_chirality.
pullback(cotangent) -> (transverse, normal, z).
OrientedChiralityContext.pushforward¶
OrientedChiralityContext.pushforward(transverse: ArrayLike, normal: ArrayLike, interval: ArrayLike) -> ComplexArray
OrientedChiralityContext.pullback¶
OrientedChiralityContext.pullback(cotangent: ArrayLike) -> tuple[RealArray, ComplexArray, RealArray]