ansys.dpf.core.operators.compression.apply_svd#

class ansys.dpf.core.operators.compression.apply_svd(field_contaner_to_compress=None, scalar_int=None, scalar_double=None, boolean=None, config=None, server=None)#

Bases: ansys.dpf.core.dpf_operator.Operator

Computes the coefficients (=U*Sigma) and VT components from SVD.

Parameters:
  • field_contaner_to_compress (FieldsContainer) – fields container to be compressed

  • scalar_int (int) – number of vectors (r) to keep for the future reconstraction of the matrix A, ex. A[m,n]=coef[m,r]*VT[r,n], where coef=U*Sigma

  • scalar_double (float) – threshold (precision) as a double, default value is 1e-7. If both pin1 and pin2 are provided, choose the min r-vectors

  • boolean (bool) – apply svd on the initial data (Default : false), otherwise use reduced data (square matrix with the smallest dimensions).

Returns:

  • us_svd (FieldsContainer) – the output entity is a field container (time dependant); it contains the multiplication of two matrices, U and S, where A=U.S.Vt

  • vt_svd (FieldsContainer) – the output entity is a field container (space dependant), containing the Vt, where A=U.S.Vt

  • sigma (Field or FieldsContainer) – the output entity is a field (or a field container if input fc contains several labels, where field contains results per label), containing singular (S) values of the input data, where A=U.S.Vt

Examples

>>> from ansys.dpf import core as dpf
>>> # Instantiate operator
>>> op = dpf.operators.compression.apply_svd()
>>> # Make input connections
>>> my_field_contaner_to_compress = dpf.FieldsContainer()
>>> op.inputs.field_contaner_to_compress.connect(my_field_contaner_to_compress)
>>> my_scalar_int = int()
>>> op.inputs.scalar_int.connect(my_scalar_int)
>>> my_scalar_double = float()
>>> op.inputs.scalar_double.connect(my_scalar_double)
>>> my_boolean = bool()
>>> op.inputs.boolean.connect(my_boolean)
>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.compression.apply_svd(
...     field_contaner_to_compress=my_field_contaner_to_compress,
...     scalar_int=my_scalar_int,
...     scalar_double=my_scalar_double,
...     boolean=my_boolean,
... )
>>> # Get output data
>>> result_us_svd = op.outputs.us_svd()
>>> result_vt_svd = op.outputs.vt_svd()
>>> result_sigma = op.outputs.sigma()
_inputs#
_outputs#
static _spec() ansys.dpf.core.operators.specification.Specification#
static default_config(server: ansys.dpf.core.server_types.AnyServerType = None) ansys.dpf.core.config.Config#

Returns the default config of the operator.

This config can then be changed to the user needs and be used to instantiate the operator. The Configuration allows to customize how the operation will be processed by the operator.

Parameters:

server – Server with channel connected to the remote or local instance. When None, attempts to use the global server.

Returns:

A new Config instance equivalent to the default config for this operator.

Return type:

config

property inputs: InputsApplySvd#

Enables to connect inputs to the operator

Returns:

An instance of InputsApplySvd.

Return type:

inputs

property outputs: OutputsApplySvd#

Enables to get outputs of the operator by evaluating it

Returns:

An instance of OutputsApplySvd.

Return type:

outputs