Trial Subspace#

Header: <pressio/rom_subspaces.hpp>

API#

namespace pressio{ namespace rom{

template<class ReducedStateType, class BasisMatrixType, class FullStateType>
/*impl defined*/ create_trial_column_subspace(BasisMatrixType && basisMatrix,
                                              FullStateType && translation,
                                              bool isAffine);

}} //end namespace

Parameters#

  • basisMatrix: the basis matrix

  • translation: the affine translation (potentially a “zero” vector)

  • isAffine: boolean to indicate the space is affine

Constraints#

Let basis_matrix_type = std::remove_cv_t<BasisMatrixType> and full_state_type = std::remove_cv_t<FullStateType>, then all of the following must hold:

  • pressio::is_vector_eigen<ReducedStateType>::value == true

  • basis_matrix_type is a rank-2 matrix data type already supported in pressio, i.e. an Eigen Matrix, a Kokkos rank-2 View, a Trilinos Tpetra multivector, Tpetra block multivector, or Epetra multivector

  • full_state_type is an Eigen vector, a Kokkos rank-1 View, a Trilinos Tpetra vector, Tpetra block vector, or Epetra vector

Preconditions#

  • basisMatrix represents a linear basis with full column rank

  • translation must be compatible with the full space, i.e. the following must hold pressio::ops::extent(translation, 0) == pressio::ops::extent(basisMatrix, 0)

Return value and effects#

Creates an instance of a trial subspace. The return type is implementation defined, so just use auto. If passing lvalue arguments, the implementation will “clone” the arguments so new allocations will occur. If passing rvalues (temporaries), the code will use move semantics, so the temporary objects are moved-constructed and no new memory allocation should occur.

Postconditions#

The return type is guaranteed to model the PossiblyAffineTrialColumnSubspace concept.

Example#

int main(){
  using basis_t  = Eigen::MatrixXd;
  using translation_t = Eigen::VectorXd;

  basis_t basis1(56,5);
  // fill such that columns are linearly independent
  translation_t translation1(56);
  auto space = create_trial_column_subspace<Eigen::VectorXd>(basis1, translation1, false);

  basis_t basis2(56,5);
  translation_t translation2(156); // violates precondition

  basis_t basis3(56,3);
  // assume the following:
  basis3.col(0).setConstant(1.);
  basis3.col(1).setConstant(2.);
  basis3.col(3).setConstant(4.);
  // basis3 is NOT full rank since it does NOT contain
  // linearly indepdent columns so this violates the precondition
}