- class ScalingOperator(domain, factor)¶
Operator which multiplies a Field with a scalar.
Operatorsupports the multiplication with a scalar. So one does not need instantiate
ScalingOperatorexplicitly 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)¶
Applies the Operator to a given x, in a specified mode.
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
INVERSE_ADJOINT_TIMES: adjoint inverse application
The processed Field defined on the Operator’s target or domain, depending on mode.
- Return type
- draw_sample_with_dtype(dtype, from_inverse=False)¶
Generates a sample from a Gaussian distribution with zero mean, covariance given by the operator and specified data type.
This method is implemented only for operators which actually draw samples (e.g. DiagonalOperator). Operators which process the sample (like SandwichOperator) implement only draw_sample().
May or may not be implemented. Only optional.
dtype (numpy.dtype or dict of numpy.dtype) – Dtype used for sampling from this operator. If the domain of op is a MultiDomain, the dtype can either be specified as one value for all components of the MultiDomain or in form of a dictionary whose keys need to conincide the with keys of the MultiDomain.
from_inverse (bool (default : False)) – if True, the sample is drawn from the inverse of the operator
A sample from the Gaussian of given covariance.
- Return type