romtools.vector_space.utils.shifter#
Notes
The vector defining the affine offset for a linear subspace is viewed as a matrix of shape
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,
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 protocol encapsulates the affine offset. The
StreamingShifter protocol additionally supports initializing a
data-derived shift vector from snapshot blocks loaded on demand.
API#
Functions
|
Shifts the data by the average of a data matrix. |
|
Shifts the data by a constant value. |
|
Shifts the data by the first vector of a data matrix. |
|
No op implementation. |
Create a shifter initialized from the temporal average of streamed data. |
|
Create a shifter initialized from the first streamed snapshot. |
|
|
Shifts the data by a user-input vector. |
Classes
|
Interface for the Shifter class. |
|
Shifter interface required by streaming POD vector spaces. |
- class romtools.vector_space.utils.shifter.Shifter(*args, **kwargs)[source]#
Bases:
ProtocolInterface 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
- class romtools.vector_space.utils.shifter.StreamingShifter(*args, **kwargs)[source]#
Bases:
Shifter,ProtocolShifter interface required by streaming POD vector spaces.
- initialize_shift_vector_from_loader(snapshot_loader, block_size, n_snapshots, comm=None)[source]#
Initialize a shift vector from snapshot blocks when required.
- Parameters:
snapshot_loader (SnapshotLoader)
block_size (int)
n_snapshots (int)
- Return type:
None
- 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:
- 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:
- 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:
- romtools.vector_space.utils.shifter.create_noop_shifter(my_array)[source]#
No op implementation.
- Parameters:
my_array (ndarray)
- Return type:
- romtools.vector_space.utils.shifter.create_streaming_average_shifter()[source]#
Create a shifter initialized from the temporal average of streamed data.
- Return type:
- romtools.vector_space.utils.shifter.create_streaming_firstvec_shifter()[source]#
Create a shifter initialized from the first streamed snapshot.
- Return type: