def _fwd_bem_multi_solution(solids, gamma, nps):
 pi2 = (1.0 / (2 * np.pi))
 n_tot = np.sum(nps)
 assert (solids.shape == (n_tot, n_tot))
 nsurf = len(nps)
 defl = (1.0 / n_tot)
 offsets = np.cumsum(np.concatenate(([0], nps)))
 for si_1 in range(nsurf):
  for si_2 in range(nsurf):
   mult = (pi2 if (gamma is None) else (pi2 * gamma[(si_1, si_2)]))
   slice_j = slice(offsets[si_1], offsets[(si_1 + 1)])
   slice_k = slice(offsets[si_2], offsets[(si_2 + 1)])
   solids[(slice_j, slice_k)] = (defl - (solids[(slice_j, slice_k)] * mult))
 solids += np.eye(n_tot)
 return linalg.inv(solids, overwrite_a=True)

def _fwd_bem_multi_solution ( solids , gamma , nps ) : pi2 = ( 1.0 / ( 2 * np . pi ) ) n_tot = np . sum ( nps ) assert ( solids . shape == ( n_tot , n_tot ) ) nsurf = len ( nps ) defl = ( 1.0 / n_tot ) offsets = np . cumsum ( np . concatenate ( ( [ 0 ] , nps ) ) ) for si_1 in range ( nsurf ) : for si_2 in range ( nsurf ) : mult = ( pi2 if ( gamma is None ) else ( pi2 * gamma [ ( si_1 , si_2 ) ] ) ) slice_j = slice ( offsets [ si_1 ] , offsets [ ( si_1 + 1 ) ] ) slice_k = slice ( offsets [ si_2 ] , offsets [ ( si_2 + 1 ) ] ) solids [ ( slice_j , slice_k ) ] = ( defl - ( solids [ ( slice_j , slice_k ) ] * mult ) ) solids += np . eye ( n_tot ) return linalg . inv ( solids , overwrite_a = True )
do multi surface solution .