nifty.cl.operators.scaling_operator module#
- class ScalingOperator(domain, factor, sampling_dtype=None)[source]#
Bases:
EndomorphicOperatorOperator which multiplies a Field with a scalar.
- Parameters:
domain (Domain or tuple of Domain or DomainTuple or MultiDomain) – The domain on which the Operator’s input Field is defined.
factor (scalar) – The multiplication factor
sampling_dtype – If this operator represents the covariance of a Gaussian probabilty distribution, sampling_dtype specifies if it is real or complex Gaussian. If sampling_dtype is None, the operator cannot be used as a covariance, i.e. no samples can be drawn. Default: None.
Notes
Operatorsupports the multiplication with a scalar. So one does not need instantiateScalingOperatorexplicitly in most cases.Formally, this operator always supports all operation modes (times, adjoint_times, inverse_times and inverse_adjoint_times), even if factor is 0 or infinity. It is the user’s responsibility to apply the operator only in appropriate ways (e.g. call inverse_times only if factor is nonzero).
Along with this behaviour comes the feature that it is possible to draw an inverse sample from a
ScalingOperator(which is a zero-field). This occurs if one draws an inverse sample of a positive definite sum of two operators each of which are only positive semi-definite. However, it is unclear whether this beviour does not lead to unwanted effects somewhere else.- apply(x, mode)[source]#
Applies the Operator to a given x, in a specified mode.
- Parameters:
x (
nifty.cl.field.Field) – The input Field, defined on the Operator’s domain or target, depending on mode.mode (int) –
TIMES: normal applicationADJOINT_TIMES: adjoint applicationINVERSE_TIMES: inverse applicationADJOINT_INVERSE_TIMESorINVERSE_ADJOINT_TIMES: adjoint inverse application
- Returns:
The processed Field defined on the Operator’s target or domain, depending on mode.
- Return type:
- draw_sample(from_inverse=False, device_id=-1)[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
device_id (int) – Device id on which the Field shall be located. Default: -1
- Returns:
A sample from the Gaussian of given covariance.
- Return type: