Closed mzuzek closed 1 year ago
@fnrizzi
did you check if Eigen setConstant and trilinos PutScalar accept a scalar value that is NOT convertible to the scalar type of the vector or matrix?
Value type must be convertible to container's scalar type - here's the breakdown by TPL:
setConstant(const Scalar &val)
with Scalar
being container's scalar typevoid ::KokkosBlas::fill(const View& X, const typename View::non_const_value_type& val);
in _kokkos-kernels/src/blas/KokkosBlas1fill.hppPutScalar()
takes double
except for Epetra_IntMultiVector
where it takes int
BlockMultiVector
has void putScalar (const Scalar& val);
and MultiVector
adds converting overload:
/// \brief Set all values in the multivector with the given value.
///
/// This method only exists if its template parameter \c T and
/// impl_scalar_type differ, and if it is syntactically possible
/// to convert \c T to impl_scalar_type. This method is mainly
/// useful for backwards compatibility, when the Scalar template
/// parameter differs from impl_scalar_type. That is commonly
/// only the case when Scalar is std::complex<U> for some type U.
template<typename T>
typename std::enable_if<! std::is_same<T, impl_scalar_type>::value && std::is_convertible<T, impl_scalar_type>::value, void>::type
putScalar (const T& value)
{
putScalar (static_cast<impl_scalar_type> (value));
}
Note: these observations are based on Trilinos@ef73d14babf6e7556b0420add98cce257ccaa56b (Pressio's dependency, see here) and may NOT apply to recent versions.
@fnrizzi
do the tests already cover non trivial cases ?
Not sure, but I'll be happy to add any reasonable cases you may have on your mind.
refs #436