コード例 #1
0
void
MiniTensorVector<T, N>::
applyBinary(Elementwise::BinaryFunction<T> const & f, Vector<T> const & x)
{
  minitensor::Vector<T, N> const
  xval = MTfromROL<T, N>(x);

  auto const
  dim  = vector_.get_dimension();

  for(minitensor::Index i{0}; i < dim; ++i) {
    vector_(i) = f.apply(vector_(i), xval(i));
  }
}
コード例 #2
0
  void applyBinary( const Elementwise::BinaryFunction<Real> &f, const Vector<Real> &x ) {
    Teuchos::RCP<const std::vector<Element> > xval = Teuchos::null;
    try {
      const DualScaledStdVector & ex = Teuchos::dyn_cast<const DualScaledStdVector>(x);
      xval = ex.getVector();
    }
    catch (std::exception &e) {
      const PrimalScaledStdVector<Real> & ex = Teuchos::dyn_cast<const PrimalScaledStdVector<Real> >(x);
      xval = ex.getVector();
    }
    uint dimension  = std_vec_->size();
    for (uint i=0; i<dimension; i++) {
      (*std_vec_)[i] = f.apply((*std_vec_)[i],(*xval)[i]);
    }

  }