biosspheres.formulations.mtf.mtf#

This module contains routines for obtaining linear operators arising in multiple traces formulations when using spherical harmonics basis as test and trial functions.

Extended summary#

  • The routines: - x_j_diagonal - x_j_diagonal_inv - x_diagonal_with_its_inv are for obtaining the operators denoted as X in the documentation. x_diagonal and x_j_diagonal_inv are for one sphere. x_diagonal_with_its_inv is for n spheres.

  • The routines: - mtf_1_matrix - mtf_1_linear_operator - mtf_1_reduced_matrix_laplace - mtf_1_reduced_linear_operator - mtf_1_reduced_matrix_helmholtz - mtf_1_reduced_linear_operator_helmholtz are for one sphere. Each one has its matrix and linear operator (with scipy) counterpart. The reduced versions is a modification of the mtf using the Schur’s complement.

  • The routines: - mtf_n_matrix - mtf_n_linear_operator_v1 - mtf_n_reduced_matrix are for multiple spheres.

Routine listings#

x_j_diagonal x_j_diagonal_inv x_diagonal_with_its_inv mtf_1_matrix mtf_1_linear_operator mtf_n_matrix mtf_n_linear_operator_v1 mtf_1_reduced_matrix_laplace mtf_1_reduced_linear_operator mtf_1_reduced_matrix_helmholtz mtf_1_reduced_linear_operator_helmholtz mtf_n_reduced_matrix

Functions

mtf_1_linear_operator(a_0j, a_j, x_j, x_j_inv)

Returns a scipy linear operator, it is equivalent to the matrix M = [2 A_{1,1}^0 , -X^{-1} ] [ -X , 2A_{1,1} ] = [ -2K_0 , 2V_0 , -I , 0 ] [ 2W_0 , 2K*_0 , 0 , pi I ] [ -I , 0 , -2K_1 , 2V_1 ] [ 0 , pi^(-1) I , 2W_1 , 2K*_1 ] All blocks are diagonal matrices.

mtf_1_matrix(r, pi, a_0j, a_j)

Returns the matrix M = [2 A_{1,1}^0 , -X^{-1} ] [ -X , 2A_{1,1} ] = [ -2K_0 , 2V_0 , -I , 0 ] [ 2W_0 , 2K*_0 , 0 , pi I ] [ -I , 0 , -2K_1 , 2V_1 ] [ 0 , pi^(-1) I , 2W_1 , 2K*_1 ] All blocks are diagonal matrices.

mtf_1_reduced_linear_operator(big_l, r, pi)

Returns a scipy linear operator equivalent to the matrix M_red

mtf_1_reduced_linear_operator_helmholtz(...)

Returns a scipy linear operator equivalent to the matrix M_red = 2 (A_{1,1}^0 - X^{-1} A_{1,1} X)

mtf_1_reduced_matrix_helmholtz(big_l, r, k0, ...)

Returns the matrix M_red = 2 (A_{1,1}^0 - X^{-1} A_{1,1} X)

mtf_1_reduced_matrix_laplace(pi, a_0)

Returns the matrix M_red

mtf_n_linear_operator_v1(big_a_0_cross, ...)

mtf_n_matrix(big_a_0_cross, ...)

mtf_n_reduced_matrix(big_a_0_cross, ...)

x_diagonal_with_its_inv(n, big_l, radii, pii)

Returns a numpy array with the diagonals of the matrices given in the functions x_j_diagonal and x_j_diagonal_inv for n spheres.

x_j_diagonal(big_l, r, pi[, azimuthal])

Returns a numpy array with the diagonal of the matrix: X_j = [I , 0 ] [0 , -(pi)^{-1} I ] with I[l*(2l+1) + m] = < I Y_l,m ; Y_l,m >_L^2(S). = r**2 for each l such that 0 <= l <= big_l, and with S: surface sphere radius r Y_l,m: spherical harmonic degree l, order m.

x_j_diagonal_inv(big_l, r, pi[, azimuthal])

Returns a numpy array with the diagonal of the matrix: X_j = [I , 0 ] [0 , -(pi)^{-1} I ] with I[l*(2l+1) + m] = < I Y_l,m ; Y_l,m >_L^2(S). = r**2 for each l such that 0 <= l <= big_l, and with S: surface sphere radius r Y_l,m: spherical harmonic degree l, order m.

biosspheres.formulations.mtf.mtf.mtf_1_linear_operator(a_0j: LinearOperator, a_j: LinearOperator, x_j: ndarray, x_j_inv: ndarray) → LinearOperator[source]#

Returns a scipy linear operator, it is equivalent to the matrix M = [2 A_{1,1}^0 , -X^{-1} ]

[ -X , 2A_{1,1} ]

= [ -2K_0 , 2V_0 , -I , 0 ]

[ 2W_0 , 2K*_0 , 0 , pi I ] [ -I , 0 , -2K_1 , 2V_1 ] [ 0 , pi^(-1) I , 2W_1 , 2K*_1 ]

All blocks are diagonal matrices.

Parameters:
  • a_0j (sparse.linalg.LinearOperator,)

  • a_j (sparse.linalg.LinearOperator,)

  • x_j (np.ndarray)

  • x_j_inv (np.ndarray)

Returns:

linear_operator – a scipy linear operator.

Return type:

sparse.linalg.LinearOperator

See also

mtf_1_matrix

biosspheres.formulations.mtf.mtf.mtf_1_matrix(r: float, pi: float, a_0j: ndarray, a_j: ndarray) → ndarray[source]#

Returns the matrix M = [2 A_{1,1}^0 , -X^{-1} ]

[ -X , 2A_{1,1} ]

= [ -2K_0 , 2V_0 , -I , 0 ]

[ 2W_0 , 2K*_0 , 0 , pi I ] [ -I , 0 , -2K_1 , 2V_1 ] [ 0 , pi^(-1) I , 2W_1 , 2K*_1 ]

All blocks are diagonal matrices.

Parameters:
  • r (float) – > 0, radius.

  • pi (float) – > 0, adimensional parameter.

  • a_0j (np.ndarray) – A_{1,1}^0

  • a_j (np.ndarray) – A_{1,1}

Returns:

mtf_matrix – Same type than a_0j. Shape 2 * Shape(a_0j)

Return type:

np.ndarray

biosspheres.formulations.mtf.mtf.mtf_1_reduced_linear_operator(big_l: int, r: float, pi: float, azimuthal: bool = True) → LinearOperator[source]#

Returns a scipy linear operator equivalent to the matrix M_red

Notes

In this case it holds: M_red = 2 [- 2 K_0 , (1 + pi^{-1}) V_0]

[(1 + pi) W_0 , 2 K_0^{*} ]

Parameters:
  • azimuthal

  • big_l (int) – >= 0, max degree.

  • r (float) – > 0, radius.

  • pi (float) – > 0, adimensional parameter.

Returns:

linear_operator – a scipy linear operator.

Return type:

sparse.linalg.LinearOperator

See also

mtf_1_reduced_matrix, a_0j_matrix, a_j_matrix, biosspheres.miscella.frommtf.x_j_diagonal

biosspheres.formulations.mtf.mtf.mtf_1_reduced_linear_operator_helmholtz(big_l: int, r: float, k0: float, k1: float, pi: float, azimuthal: bool) → LinearOperator[source]#

Returns a scipy linear operator equivalent to the matrix M_red = 2 (A_{1,1}^0 - X^{-1} A_{1,1} X)

Notes

In this case it holds: M_red = 2 [ -(K_0 - K_1) , V_0 + pi^{-1} V_1]

[ W_0 + pi W_1 , K_0 - K_1 ]

Parameters:
  • big_l (int) – >= 0, max degree.

  • r (float) – > 0, radius.

  • k0 (float)

  • k1 (float)

  • pi (float) – > 0, adimensional parameter.

  • azimuthal (bool)

Returns:

linear_operator – a scipy linear operator.

Return type:

sparse.linalg.LinearOperator

See also

mtf_1_reduced_matrix

biosspheres.formulations.mtf.mtf.mtf_1_reduced_matrix_helmholtz(big_l: int, r: float, k0: float, k1: float, pi: float, azimuthal: bool) → ndarray[source]#

Returns the matrix M_red = 2 (A_{1,1}^0 - X^{-1} A_{1,1} X)

Notes

In this case it holds: M_red = 2 [ -(K_0 - K_1) , V_0 + pi^{-1} V_1]

[ W_0 + pi W_1 , K_0 - K_1 ]

Parameters:
  • big_l (int) – >= 0, max degree.

  • r (float) – > 0, radius.

  • k0 (float)

  • k1 (float)

  • pi (float) – > 0, adimensional parameter.

  • azimuthal (bool)

Returns:

matrix – with complex values. Shape (2*(big_l+1)**2, 2*(big_l+1)**2)

Return type:

np.ndarray

biosspheres.formulations.mtf.mtf.mtf_1_reduced_matrix_laplace(pi: float, a_0: ndarray) → ndarray[source]#

Returns the matrix M_red

Notes

In this case it holds: M_red = 2 [- 2 K_0 , (1 + pi^{-1}) V_0]

[(1 + pi) W_0 , 2 K_0^{*} ]

Parameters:
  • pi (float) – > 0, adimensional parameter.

  • a_0 (np.ndarray) – A_{1,1}^0

Returns:

matrix – of floats. Same shape than a_0.

Return type:

np.ndarray

biosspheres.formulations.mtf.mtf.x_diagonal_with_its_inv(n: int, big_l: int, radii: float, pii: ndarray, azimuthal: bool = False)[source]#

Returns a numpy array with the diagonals of the matrices given in the functions x_j_diagonal and x_j_diagonal_inv for n spheres.

Notes

Parameters:
  • n (int) – >=1 number of spheres

  • big_l (int) – >= 0

  • radii (np.ndarray) – of float > 0, array with the radius

  • pii (np.ndarray) – of float > 0, adimensional parameter.

  • azimuthal (bool, if True, then only the values for m = 0 are) – computed. default = False.

Returns:

  • x_dia (np.ndarray) – of floats. If azimuthal = False, its length is 2n(big_l+1), else it is 2n(big_l+1)**2.

  • x_inv (np.ndarray) – of floats. = 1. / x_dia

biosspheres.formulations.mtf.mtf.x_j_diagonal(big_l: int, r: float, pi: ndarray, azimuthal: bool = True) → ndarray[source]#

Returns a numpy array with the diagonal of the matrix: X_j = [I , 0 ]

[0 , -(pi)^{-1} I ]

with I[l*(2l+1) + m] = < I Y_l,m ; Y_l,m >_L^2(S).

= r**2

for each l such that 0 <= l <= big_l, and with S: surface sphere radius r Y_l,m: spherical harmonic degree l, order m.

Parameters:
  • big_l (int) – >= 0

  • r (float) – > 0, radius

  • pi (float) – > 0, adimensional parameter.

  • azimuthal (bool, if True, then only the values for m = 0 are) – computed. default = True

Returns:

x_j – of floats. If azimuthal = False, its is length 2*(big_l+1), else it is 2*(big_l+1)**2.

Return type:

np.ndarray

biosspheres.formulations.mtf.mtf.x_j_diagonal_inv(big_l: int, r: float, pi: float, azimuthal: bool = True) → ndarray[source]#

Returns a numpy array with the diagonal of the matrix: X_j = [I , 0 ]

[0 , -(pi)^{-1} I ]

with I[l*(2l+1) + m] = < I Y_l,m ; Y_l,m >_L^2(S).

= r**2

for each l such that 0 <= l <= big_l, and with S: surface sphere radius r Y_l,m: spherical harmonic degree l, order m.

Parameters:
  • big_l (int) – >= 0

  • r (float) – > 0, radius

  • pi (float) – > 0, adimensional parameter.

  • azimuthal (bool, if True, then only the values for m = 0 are) – computed.

Returns:

x_j – of floats. If azimuthal = False, its is length 2*(big_l+1), else it is 2*(big_l+1)**2.

Return type:

np.ndarray