romtools.vector_space.utils.shifter#

Notes

The vector defining the affine offset for a linear subspace is viewed as a matrix of shape

\[\mathbf{u}_{\mathrm{shift}} \in \mathbb{R}^{N_{\mathrm{vars}} \times N_{\mathrm{x}} }\]

Theory#

What is a shift vector, and why would I use it? In ROMs, we restrict a state to belong to a low-dimensional affine vector space, .. math:

\mathbf{u} \approx \tilde{\mathbf{u}} \in \mathcal{V} + \mathbf{u}_{\mathrm{shift}}

where \(\mathcal{V} \equiv \mathrm{range}(\boldsymbol \Phi)\). Here \(\mathbf{u}_{\mathrm{shift}}\) defines an affine offset. Affine offsets can be useful for a variety of reasons, including satisfying boundary conditions, and satisfying initial conditions.

The _Shifter class encapsulates the affine offset.

API#

Functions

create_average_shifter(my_array)

Shifts the data by the average of a data matrix.

create_constant_shifter(shift_value, my_array)

Shifts the data by a constant value.

create_firstvec_shifter(my_array)

Shifts the data by the first vector of a data matrix.

create_noop_shifter(my_array)

No op implementation.

create_vector_shifter(shift_vector)

Shifts the data by a user-input vector.

Classes

Shifter(*args, **kwargs)

Interface for the Shifter class.

class romtools.vector_space.utils.shifter.Shifter(*args, **kwargs)[source]#

Bases: Protocol

Interface for the Shifter class.

apply_inverse_shift(my_array)[source]#

Shifts the snapshot matrix by adding a vector generated by the public-facing free functions.

Parameters:

my_array (ndarray)

Return type:

None

apply_shift(my_array)[source]#

Shifts the snapshot matrix by subtracting a vector generated by the public-facing free functions.

Parameters:

my_array (ndarray)

Return type:

None

get_shift_vector()[source]#

Returns the vector used to shift the data.

Return type:

ndarray

romtools.vector_space.utils.shifter.create_average_shifter(my_array)[source]#

Shifts the data by the average of a data matrix.

Parameters:

my_array (ndarray)

Return type:

Shifter

romtools.vector_space.utils.shifter.create_constant_shifter(shift_value, my_array)[source]#

Shifts the data by a constant value.

Parameters:

my_array (ndarray)

Return type:

Shifter

romtools.vector_space.utils.shifter.create_firstvec_shifter(my_array)[source]#

Shifts the data by the first vector of a data matrix.

Parameters:

my_array (ndarray)

Return type:

Shifter

romtools.vector_space.utils.shifter.create_noop_shifter(my_array)[source]#

No op implementation.

Parameters:

my_array (ndarray)

Return type:

Shifter

romtools.vector_space.utils.shifter.create_vector_shifter(shift_vector)[source]#

Shifts the data by a user-input vector.

Parameters:

shift_vector (ndarray)

Return type:

Shifter