pihnn.nn.L_PIHNN#

class pihnn.nn.L_PIHNN(PDE, units, singularities, material={'lambda': 1, 'mu': 1}, activation=torch.exp, has_bias=True, rhs_solution=None)#

Bases: PIHNN

Laurent physics-informed holomorphic neural networks (L-PIHNNs) from Calafà et al. [2026].

L-PIHNNs are able to extend PIHNNs to multiply-connected domains without using domain decomposition by approximating the holomorphic solution at the annulus through a Laurent series.

The idea is to consider multiple network branches for each domain hole and evaluate

\[NN(z)=NN_0(z) + \sum_{s=1}^{S}NN_s\left(\frac{1}{z-z_s}\right) + p_s \ln(z-z_s),\]

where \(\{NN_s\}_{s=0}^S\) are standard PIHNNs, \(S\in\mathbb{N}\) is the number of holes in the domain and \(\{z_s\}_{s=1}^S \subset \mathbb{C}\) are coordinates of points inside each hole. In addition, \(p_s\in\mathbb{C}\) are trainable parameters, needed to take into account the multi-valued nature of harmonic functions on multiply-connected domains.

Parameters:
  • PDE (str) – Problem to solve, either ‘laplace’, ‘biharmonic’, ‘km’ or ‘km-so’.

  • units (list of int) – Number of units at each layer for \(NN_0\), e.g., [1,10,10,1].

  • singularities (List of dictionaries) – List with the information about singularities. Each element of the list (\(s=1,\dots,S\)) is a dictionary containing \(z_s\) (“location”) and units of \(NN_s\) (“units”).

  • material (dict) – Properties of the material, dictionary with ‘lambda’ (first Lamé coefficient), ‘mu’ (second Lamé coefficient).

  • activation (callable) – Activation function, by default the complex exponential.

  • has_bias (bool) – True if the linear layers include bias vectors.

  • rhs_solution (callable) – Particular solution to the non-homogeneous problem. E.g., \(x^2+y^2\) for \(\nabla^2u=4\).

forward(z, real_output=False)#

Forward step, i.e., compute:

\[\mathcal{L}_{L,t,0} \circ \phi \circ \dots \circ \phi \circ \mathcal{L}_{1,t,0} (z) + \sum_{s=1}^S \mathcal{L}_{L,t,s} \circ \phi \dots \phi \circ \mathcal{L}_{1,t,s} \left(\frac{1}{z-z_s}\right) + p_s \ln(z-z_s)\]

where \(z\) is the input, \(\phi\) the activation function and \(\{\mathcal{L}_{l,t,s}\}\) the complex linear layers (pihnn.nn.ComplexLinear) for each layer \(l=1,\dots,L\), stacked network \(t=1,\dots,T\) and singularity \(s=1,\dots,S\).

Parameters:
  • z (torch.tensor(dtype=torch.complex128)) – Input of the network, typically a batch of coordinates from the domain boundary.

  • real_output (bool) – Whether to provide the output in the real-valued representation.

Returns:

phi (torch.tensor(dtype=torch.complex128)) - Output of the network.

initialize_weights(method, beta=0.5, sample=None, gauss=None, include_analytical_part=True, include_principal_part=True)#

Equivalent to pihnn.nn.PIHNN.init() but applies also to \(NN_s,s\ge 1\).

Parameters:
  • method (str) – Either ‘he’, ‘he_scaled’, ‘exp’, ‘kan’ see description above.

  • beta (float) – Scaling coefficient in the scaled He initialization, \(\beta\) coefficient in the Calafà initialization, not used in He initialization.

  • sample (torch.tensor(dtype=torch.complex128)) – Initial sample \(x_0\) in the Calafà initialization, not used in the other methods.

  • gauss (int) – \(M_e\) coefficient in the Calafà initialization, not used in the other methods.

  • include_analytical_part (bool) – If the initialization is applied to the analytical part (\(s=0\)).

  • include_principal_part – If the initialization is applied to the principal part (\(s=1,\dots,S\)).