nifty7.operators.simple_linear_operators module

class ConjugationOperator(domain)[source]

Bases: nifty7.operators.endomorphic_operator.EndomorphicOperator

Operator computing the complex conjugate of its input.

Parameters

domain (Domain, tuple of domains or DomainTuple) – domain of the input field

apply(x, mode)[source]

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

Parameters
  • x (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

Field

class FieldAdapter(target, name)[source]

Bases: nifty7.operators.linear_operator.LinearOperator

Operator for conversion between Fields and MultiFields.

Parameters
  • tgt (Domain, tuple of domains, DomainTuple, dict or MultiDomain:) – If this is a Domain, tuple of Domain or DomainTuple, this will be the operator’s target, and its domain will be a MultiDomain consisting of its domain with the supplied name If this is a dict or MultiDomain, everything except for name will be stripped out of it, and the result will be the operator’s target. Its domain will then be the DomainTuple corresponding to the single entry in the operator’s domain.

  • name (String) – The relevant key of the MultiDomain.

__repr__()[source]

Return repr(self).

apply(x, mode)[source]

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

Parameters
  • x (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

Field

class GeometryRemover(domain, space=None)[source]

Bases: nifty7.operators.linear_operator.LinearOperator

Operator which transforms between a structured and an unstructured domain.

Parameters
  • domain (Domain, tuple of Domain, or DomainTuple:) – the full input domain of the operator.

  • space (int, optional) – The index of the subdomain on which the operator should act. If None, it acts on all spaces.

Notes

The operator will convert every sub-domain of its input domain to an UnstructuredDomain with the same shape. No weighting by volume factors is carried out.

apply(x, mode)[source]

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

Parameters
  • x (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

Field

class Imaginizer(domain)[source]

Bases: nifty7.operators.endomorphic_operator.EndomorphicOperator

Operator returning the imaginary component of its input.

Parameters

domain (Domain, tuple of domains or DomainTuple) – domain of the input field

apply(x, mode)[source]

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

Parameters
  • x (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

Field

class NullOperator(domain, target)[source]

Bases: nifty7.operators.linear_operator.LinearOperator

Operator corresponding to a matrix of all zeros.

Parameters
__repr__()[source]

Return repr(self).

apply(x, mode)[source]

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

Parameters
  • x (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

Field

draw_sample(from_inverse=False)[source]
class PartialExtractor(domain, target)[source]

Bases: nifty7.operators.linear_operator.LinearOperator

NIFTY base class for linear operators.

The base NIFTY operator class is an abstract class from which other specific operator subclasses are derived.

Variables
  • ~PartialExtractor.TIMES (int) – Symbolic constant representing normal operator application

  • ~PartialExtractor.ADJOINT_TIMES (int) – Symbolic constant representing adjoint operator application

  • ~PartialExtractor.INVERSE_TIMES (int) – Symbolic constant representing inverse operator application

  • ~PartialExtractor.ADJOINT_INVERSE_TIMES (int) – Symbolic constant representing adjoint inverse operator application

  • ~PartialExtractor.INVERSE_ADJOINT_TIMES (int) – same as ADJOINT_INVERSE_TIMES

Notes

The symbolic constants for the operation modes can be combined by the “bitwise-or” operator “|”, for expressing the capability of the operator by means of a single integer number.

__repr__()[source]

Return repr(self).

apply(x, mode)[source]

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

Parameters
  • x (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

Field

class PrependKey(domain, pre)[source]

Bases: nifty7.operators.linear_operator.LinearOperator

Prepend a string to all keys of a MultiDomain.

Parameters
apply(x, mode)[source]

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

Parameters
  • x (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

Field

class Realizer(domain)[source]

Bases: nifty7.operators.endomorphic_operator.EndomorphicOperator

Operator returning the real component of its input.

Parameters

domain (Domain, tuple of domains or DomainTuple) – domain of the input field

apply(x, mode)[source]

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

Parameters
  • x (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

Field

class VdotOperator(field)[source]

Bases: nifty7.operators.linear_operator.LinearOperator

Operator computing the scalar product of its input with a given Field.

Parameters

field (Field or MultiField) – The field used to build the scalar product with the operator input

apply(x, mode)[source]

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

Parameters
  • x (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

Field

class WeightApplier(domain, spaces, power)[source]

Bases: nifty7.operators.endomorphic_operator.EndomorphicOperator

Operator multiplying its input by a given power of dvol.

Parameters
  • domain (Domain, tuple of domains or DomainTuple) – domain of the input field

  • spaces (list or tuple of int) – indices of subdomains for which the weights shall be applied

  • power (int) – the power of to be used for the volume factors

apply(x, mode)[source]

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

Parameters
  • x (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

Field

ducktape(left, right, name)[source]

Convenience function creating an operator that converts between a DomainTuple and a MultiDomain.

Parameters
  • left (None, Operator, or Domainoid) – Something describing the new operator’s target domain. If left is an Operator, its domain is used as left.

  • right (None, Operator, or Domainoid) – Something describing the new operator’s input domain. If right is an Operator, its target is used as right.

  • name (string) – The component of the MultiDomain that will be extracted/inserted

Notes

  • one of the involved domains must be a DomainTuple, the other a MultiDomain.

  • left and right must not be both None, but one of them can (and probably should) be None. In this case, the missing information is inferred.

Returns

an adapter operator converting between the two (possibly partially inferred) domains.

Return type

FieldAdapter or _SlowFieldAdapter