nifty8.operators.block_diagonal_operator module#

class BlockDiagonalOperator(domain, operators)[source]#

Bases: EndomorphicOperator

Parameters:
  • domain (MultiDomain) – Domain and target of the operator.

  • operators (dict) – Dictionary with subdomain names as keys and LinearOperator s as items. Any missing item will be treated as unity operator.

__init__(domain, operators)[source]#
__repr__()[source]#

Return repr(self).

apply(x, mode)[source]#

Applies the Operator to a given x, in a specified mode.

Parameters:
  • x (nifty8.field.Field) – The input Field, defined on the Operator’s domain or target, depending on mode.

  • mode (int) –

    • TIMES: normal application

    • ADJOINT_TIMES: adjoint application

    • INVERSE_TIMES: inverse application

    • ADJOINT_INVERSE_TIMES or INVERSE_ADJOINT_TIMES: adjoint inverse application

Returns:

The processed Field defined on the Operator’s target or domain, depending on mode.

Return type:

nifty8.field.Field

draw_sample(from_inverse=False)[source]#

Generates a sample from a Gaussian distribution with zero mean and covariance given by the operator.

May or may not be implemented. Only optional.

Parameters:

from_inverse (bool (default : False)) – if True, the sample is drawn from the inverse of the operator

Returns:

A sample from the Gaussian of given covariance.

Return type:

nifty8.field.Field or nifty8.multi_field.MultiField

get_sqrt()[source]#

Return operator op which obeys self == op.adjoint @ op.

Note that this function is only implemented for operators with real spectrum.

Returns:

Operator which is the square root of self

Return type:

EndomorphicOperator