nifty8.operators.operator module#
- class Operator[source]#
Bases:
object
Transforms values defined on one domain into values defined on another domain, and can also provide the Jacobian.
- abs(*args, **kwargs)#
- abs_pre(*args, **kwargs)#
- absolute(*args, **kwargs)#
- absolute_pre(*args, **kwargs)#
- apply(x)[source]#
Applies the operator to a Field, MultiField or Linearization.
- Parameters:
x (
nifty8.field.Field
,nifty8.multi_field.MultiField
,) – ornifty8.linearization.Linearization
Input on which the operator shall act. Needs to be defined ondomain
. If x`is a :class:`nifty8.linearization.Linearization, apply returns a newnifty8.linearization.Linearization
contining the result of the operator application as well as its Jacobian, evaluated at x.
- apply_to_random_sample(**kwargs)[source]#
Applies the operator to a sample drawn with ift.sugar.from_random. Keyword arguments are passed through to the sample generation.
Warning
If not specified otherwise, the sample will be of dtype np.float64. If the operator requires input values of other dtypes, this needs to be indicated with the dtype keyword argument.
- arctan(*args, **kwargs)#
- arctan_pre(*args, **kwargs)#
- clip(*args, **kwargs)#
- clip_pre(*args, **kwargs)#
- cos(*args, **kwargs)#
- cos_pre(*args, **kwargs)#
- cosh(*args, **kwargs)#
- cosh_pre(*args, **kwargs)#
- property domain#
The domain on which the Operator’s input Field is defined.
- Returns:
domain
- Return type:
- exp(*args, **kwargs)#
- exp_pre(*args, **kwargs)#
- expm1(*args, **kwargs)#
- expm1_pre(*args, **kwargs)#
- exponentiate(*args, **kwargs)#
- exponentiate_pre(*args, **kwargs)#
- property imag#
- property jac#
The Jacobian associated with this object. For “pure” operators this is None. For Field-like objects this can be None (in which case the object is a constant), or it can be a LinearOperator with domain and target matching the object’s.
- Returns:
None or LinearOperator
- Return type:
the Jacobian
Notes
if value is None, this must be None as well!
- property jax_expr: Callable | None#
Equivalent representation of the operator in JAX.
- log(*args, **kwargs)#
- log10(*args, **kwargs)#
- log10_pre(*args, **kwargs)#
- log1p(*args, **kwargs)#
- log1p_pre(*args, **kwargs)#
- log_pre(*args, **kwargs)#
- property metric#
The metric associated with the object. This is None, except when all the following conditions hold: - want_metric is True
target is the scalar domain
the operator chain contained an operator which could compute the metric
- Returns:
None or LinearOperator
- Return type:
the metric
- power(*args, **kwargs)#
- power_pre(*args, **kwargs)#
- property real#
- reciprocal(*args, **kwargs)#
- reciprocal_pre(*args, **kwargs)#
- sigmoid(*args, **kwargs)#
- sigmoid_pre(*args, **kwargs)#
- sign(*args, **kwargs)#
- sign_pre(*args, **kwargs)#
- sin(*args, **kwargs)#
- sin_pre(*args, **kwargs)#
- sinc(*args, **kwargs)#
- sinc_pre(*args, **kwargs)#
- sinh(*args, **kwargs)#
- sinh_pre(*args, **kwargs)#
- softplus(*args, **kwargs)#
- softplus_pre(*args, **kwargs)#
- sqrt(*args, **kwargs)#
- sqrt_pre(*args, **kwargs)#
- tan(*args, **kwargs)#
- tan_pre(*args, **kwargs)#
- tanh(*args, **kwargs)#
- tanh_pre(*args, **kwargs)#
- property target#
The domain on which the Operator’s output Field is defined.
- Returns:
target
- Return type:
- transpose(indices)[source]#
Transposes a Field.
- Parameters:
indices (tuple) – Must be a tuple or list which contains a permutation of [0,1,..,N-1] where N is the number of domains in the target of the Operator (or the Field).
- unitstep(*args, **kwargs)#
- unitstep_pre(*args, **kwargs)#
- property val#
The numerical value associated with this object For “pure” operators this is None. For Field-like objects this is a numpy.ndarray or a dictionary of numpy.ndarray`s mathcing the object’s `target.
- Returns:
None or numpy.ndarray or dictionary of np.ndarrays
- Return type:
the numerical value
- property want_metric#
Whether a metric should be computed for the full expression. This is False whenever jac is None. In other cases it signals that operators processing this object should compute the metric.
- Returns:
bool
- Return type:
whether the metric should be computed